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
900
2017 - Building Bridges: Stopping Python 2 without damages
pybay
0
630
2017 - Bringing Python 3 to LinkedIn
pybay
1
550
2017 - Python Debugging with PUDB
pybay
0
680
2017 - Opening up to Open Source
pybay
0
250
2017 - A Gentle Introduction to Text Classification with Deep Learning
pybay
2
180
2017 - Performant Asynchronous Programming at Quora
pybay
1
370
2017 - latus - a Personal Cloud Storage App written in Python
pybay
2
500
2017 - Everything You Ever Wanted to Know About Web Authentication in Python
pybay
3
600
Other Decks in Programming
See All in Programming
AIコーディングワークフローの試行 〜AIエージェント×ワークフローでの自動化を目指して〜
rkaga
3
3.7k
VitestのIn-Source Testingが便利
taro28
6
2k
大LLM時代にこの先生きのこるには-ITエンジニア編
fumiyakume
7
3k
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
0
110
Lambda(Python)の リファクタリングが好きなんです
komakichi
3
200
監視 やばい
syossan27
9
8k
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.7k
リアルタイムレイトレーシング + ニューラルレンダリング簡単紹介 / Real-Time Ray Tracing & Neural Rendering: A Quick Introduction (2025)
shocker_0x15
1
310
Rollupのビルド時間高速化によるプレビュー表示速度改善とバンドラとASTを駆使したプロダクト開発の難しさ
plaidtech
PRO
1
170
海外のアプリで見かけたかっこいいTransitionを真似てみる
shogotakasaki
1
170
サービスレベルを管理してアジャイルを加速しよう!! / slm-accelerate-agility
tomoyakitaura
1
180
gen_statem - OTP's Unsung Hero
whatyouhide
1
200
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
GitHub's CSS Performance
jonrohan
1030
460k
Music & Morning Musume
bryan
47
6.5k
Side Projects
sachag
452
42k
Become a Pro
speakerdeck
PRO
27
5.3k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Unsuck your backbone
ammeep
670
57k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
41
2.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
12k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
5
550
It's Worth the Effort
3n
184
28k
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
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