Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
2017 - Reverb Chu - Concurrent Testing with py....
Search
PyBay
August 13, 2017
Programming
0
170
2017 - Reverb Chu - Concurrent Testing with py.test
Introducing a different way to perform concurrent testing with the py.test framework.
PyBay
August 13, 2017
Tweet
Share
More Decks by PyBay
See All by PyBay
2017 - The Packaging Gradient
pybay
2
920
2017 - Building Bridges: Stopping Python 2 without damages
pybay
0
650
2017 - Bringing Python 3 to LinkedIn
pybay
1
560
2017 - Python Debugging with PUDB
pybay
0
710
2017 - Opening up to Open Source
pybay
0
250
2017 - A Gentle Introduction to Text Classification with Deep Learning
pybay
2
190
2017 - Performant Asynchronous Programming at Quora
pybay
1
380
2017 - latus - a Personal Cloud Storage App written in Python
pybay
2
520
2017 - Everything You Ever Wanted to Know About Web Authentication in Python
pybay
3
620
Other Decks in Programming
See All in Programming
2度もゼロから書き直して、やっとブラウザでぬるぬる動くAIに辿り着いた話
tomoino
0
150
Parallel::Pipesの紹介
skaji
2
900
Java on Azure で LangGraph!
kohei3110
0
110
FastMCPでMCPサーバー/クライアントを構築してみる
ttnyt8701
2
130
無関心の谷
kanayannet
0
160
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
1
180
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
200
事業戦略を理解してソフトウェアを設計する
masuda220
PRO
21
5.9k
セキュリティマネジャー廃止とクラウドネイティブ型サンドボックス活用
kazumura
1
170
Rails産でないDBを Railsに引っ越すHACK - Omotesando.rb #110
lnit
1
160
エラーって何種類あるの?
kajitack
5
130
「兵法」から見る質とスピード
ickx
0
260
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
The Cult of Friendly URLs
andyhume
79
6.4k
The Cost Of JavaScript in 2023
addyosmani
50
8.3k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.6k
Producing Creativity
orderedlist
PRO
346
40k
It's Worth the Effort
3n
184
28k
Code Review Best Practice
trishagee
68
18k
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
650
Transcript
Concurrent Testing with py.test Reverb Chu, Sr. SWE @ Trend
Micro James Wang, UGrad CS Student @ Uni. of Washington
https://goo.gl/mxthn3
https://goo.gl/mxthn3 https://www.apple.com/macbook/
https://goo.gl/mxthn3
Current Solutions https://goo.gl/mxthn3
Current Solutions 1. pytest-xdist https://goo.gl/mxthn3
Current Solutions 1. pytest-xdist 2. ...there’s no 2. https://goo.gl/mxthn3
Why Not pytest-xdist? - Designed for test distribution - Only
support multiprocessing - Not able to do test grouping https://goo.gl/mxthn3
pytest-concurrent life is too short for sequential tests https://goo.gl/mxthn3
Different Concurrent Mode mthread - Impl. with threading - For
IO intensive tests mproc - Impl. with multiprocessing - For CPU intensive tests asyncnet - Impl. with gevent - For network IO intensive tests https://goo.gl/mxthn3
Configurable Worker Amount $ pytest --concmode=mthread --concworkers=10 https://goo.gl/mxthn3
Configurable Worker Amount $ pytest --concmode=mthread --concworkers=max https://goo.gl/mxthn3
Testing in Groups import pytest import time @pytest.mark.concgroup(1) @pytest.mark.parametrize('para', [1,
2, 3, 4, 5]) def test_something(para): time.sleep(2) assert para % 2 @pytest.mark.concgroup(1) def test_something_else(): time.sleep(1) assert 1 == 2 @pytest.mark.concgroup(2) @pytest.mark.parametrize('name', ['this', 'is', 'a', 'book']) def test_second_group(name): time.sleep(2) def test_something_last(): time.sleep(2) raise MemoryError @pytest.mark.concgroup(group: int) https://goo.gl/mxthn3
May ?? I want it... https://goo.gl/mxthn3
May ?? I want it... Jun 20 Intern Onboard https://goo.gl/mxthn3
May ?? I want it... Jul 31 Let’s Do This
Jun 20 Intern Onboard https://goo.gl/mxthn3
May ?? I want it... Aug 11 v0.1.2 Jul 31
Let’s Do This Jun 20 Intern Onboard Aug 10 v0.1.1 Aug 9 v0.1.0 https://goo.gl/mxthn3
$ pip install pytest-concurrent https://goo.gl/mxthn3 @reverbc @jamesw96