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
180
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
950
2017 - Building Bridges: Stopping Python 2 without damages
pybay
0
670
2017 - Bringing Python 3 to LinkedIn
pybay
1
570
2017 - Python Debugging with PUDB
pybay
0
740
2017 - Opening up to Open Source
pybay
0
270
2017 - A Gentle Introduction to Text Classification with Deep Learning
pybay
2
200
2017 - Performant Asynchronous Programming at Quora
pybay
1
390
2017 - latus - a Personal Cloud Storage App written in Python
pybay
2
530
2017 - Everything You Ever Wanted to Know About Web Authentication in Python
pybay
3
650
Other Decks in Programming
See All in Programming
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
350
NIKKEI Tech Talk#38
cipepser
0
120
品質ワークショップをやってみた
nealle
0
600
AI駆動で0→1をやって見えた光と伸びしろ
passion0102
1
770
実践Claude Code:20の失敗から学ぶAIペアプログラミング
takedatakashi
16
6.5k
Reactive Thinking with Signals and the Resource API
manfredsteyer
PRO
0
100
組込みだけじゃない!TinyGo で始める無料クラウド開発入門
otakakot
2
350
monorepo の Go テストをはやくした〜い!~最小の依存解決への道のり~ / faster-testing-of-monorepos
convto
2
520
CSC509 Lecture 08
javiergs
PRO
0
230
CSC509 Lecture 05
javiergs
PRO
0
310
はじめてのDSPy - 言語モデルを『プロンプト』ではなく『プログラミング』するための仕組み
masahiro_nishimi
3
11k
タスクの特性や不確実性に応じた最適な作業スタイルの選択(ペアプロ・モブプロ・ソロプロ)と実践 / Optimal Work Style Selection: Pair, Mob, or Solo Programming.
honyanya
3
190
Featured
See All Featured
Speed Design
sergeychernyshev
32
1.2k
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
54k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
115
20k
YesSQL, Process and Tooling at Scale
rocio
173
15k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
jQuery: Nuts, Bolts and Bling
dougneiner
65
7.9k
It's Worth the Effort
3n
187
28k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
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