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
190
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
960
2017 - Building Bridges: Stopping Python 2 without damages
pybay
0
680
2017 - Bringing Python 3 to LinkedIn
pybay
1
580
2017 - Python Debugging with PUDB
pybay
0
750
2017 - Opening up to Open Source
pybay
0
270
2017 - A Gentle Introduction to Text Classification with Deep Learning
pybay
2
210
2017 - Performant Asynchronous Programming at Quora
pybay
1
390
2017 - latus - a Personal Cloud Storage App written in Python
pybay
2
540
2017 - Everything You Ever Wanted to Know About Web Authentication in Python
pybay
3
660
Other Decks in Programming
See All in Programming
自動テストを活かすためのテスト分析・テスト設計の進め方/JaSST25 Shikoku
goyoki
3
690
知られているようで知られていない JavaScriptの仕様 4選
syumai
0
610
Module Harmony
petamoriken
2
400
PyCon mini 東海 2025「個人ではじめるマルチAIエージェント入門 〜LangChain × LangGraphでアイデアを形にするステップ〜」
komofr
3
1k
開発生産性が組織文化になるまでの軌跡
tonegawa07
0
170
例外処理を理解して、設計段階からエラーを見つけやすく、起こりにくく #phpconfuk
kajitack
12
6.2k
Amazon Bedrock Knowledge Bases Hands-on
konny0311
0
150
競馬で学ぶ機械学習の基本と実践 / Machine Learning with Horse Racing
shoheimitani
13
12k
レイトレZ世代に捧ぐ、今からレイトレを始めるための小径
ichi_raven
0
350
Flutterチームから作る組織の越境文化
findy_eventslides
0
110
All(?) About Point Sets
hole
0
160
MCPサーバー「モディフィウス」で変更容易性の向上をスケールする / modifius
minodriven
8
1.5k
Featured
See All Featured
BBQ
matthewcrist
89
9.9k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
A better future with KSS
kneath
239
18k
Practical Orchestrator
shlominoach
190
11k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
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