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.test
Search
PyBay
August 13, 2017
Programming
0
110
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
720
2017 - Building Bridges: Stopping Python 2 without damages
pybay
0
510
2017 - Bringing Python 3 to LinkedIn
pybay
1
460
2017 - Python Debugging with PUDB
pybay
0
470
2017 - Opening up to Open Source
pybay
0
170
2017 - A Gentle Introduction to Text Classification with Deep Learning
pybay
2
130
2017 - Performant Asynchronous Programming at Quora
pybay
1
280
2017 - latus - a Personal Cloud Storage App written in Python
pybay
2
400
2017 - Everything You Ever Wanted to Know About Web Authentication in Python
pybay
3
400
Other Decks in Programming
See All in Programming
決断するための勇気、そのためのBacklog / Courage to make decisions, Backlog for that.
seike460
PRO
4
1.9k
Why 1 + 1 = 2 in Swift?
1plus4
1
240
ドメイン・ファーストで考える問題解決に役立つモデル設計 / Domain First Model Design
suzushin54
1
1.4k
Creating Retro-Style Photos Using Swift
ski
1
340
ONE WEDGE_Company_Information
1wedge
0
170
PHP 8.3で追加されたjson_validate()を徹底的に深掘りしてみよう
mashirou1234
1
720
Laravel標準バリデーションでできること
hmb_ok
2
360
WinUI 3デモ - "CommunityToolkit.Mvvm"NuGetパッケージ編
andrewkeepcoding
0
130
phpunit/php-code-coverageって何をしてるんだ #phperkaigi
o0h
PRO
2
220
Building a Smaller App Binary
kateinoigakukun
2
200
品質が高いコードって何?Rev2.1
ickx
1
490
導入から5年が経って見えた Datadog APM 運用の課題
bgpat
2
540
Featured
See All Featured
Become a Pro
speakerdeck
PRO
8
4.4k
GraphQLとの向き合い方2022年版
quramy
28
12k
Navigating Team Friction
lara
177
13k
How to train your dragon (web standard)
notwaldorf
71
5.1k
Why You Should Never Use an ORM
jnunemaker
PRO
50
8.6k
Into the Great Unknown - MozCon
thekraken
10
830
Code Reviewing Like a Champion
maltzj
512
39k
Pencils Down: Stop Designing & Start Developing
hursman
115
11k
Building an army of robots
kneath
300
41k
Being A Developer After 40
akosma
56
580k
Practical Orchestrator
shlominoach
180
9.7k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.8k
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