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
150
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
860
2017 - Building Bridges: Stopping Python 2 without damages
pybay
0
610
2017 - Bringing Python 3 to LinkedIn
pybay
1
530
2017 - Python Debugging with PUDB
pybay
0
610
2017 - Opening up to Open Source
pybay
0
230
2017 - A Gentle Introduction to Text Classification with Deep Learning
pybay
2
170
2017 - Performant Asynchronous Programming at Quora
pybay
1
340
2017 - latus - a Personal Cloud Storage App written in Python
pybay
2
480
2017 - Everything You Ever Wanted to Know About Web Authentication in Python
pybay
3
550
Other Decks in Programming
See All in Programming
ドメインイベント増えすぎ問題
h0r15h0
2
560
Beyond ORM
77web
11
1.6k
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
190
Findy Team+ Awardを受賞したかった!ベストプラクティス応募内容をふりかえり、開発生産性向上もふりかえる / Findy Team Plus Award BestPractice and DPE Retrospective 2024
honyanya
0
140
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
290
QA環境で誰でも自由自在に現在時刻を操って検証できるようにした話
kalibora
1
140
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
270
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
1.3k
watsonx.ai Dojo #6 継続的なAIアプリ開発と展開
oniak3ibm
PRO
0
170
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
240
Fibonacci Function Gallery - Part 2
philipschwarz
PRO
0
210
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
180
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Faster Mobile Websites
deanohume
305
30k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
It's Worth the Effort
3n
183
28k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Practical Orchestrator
shlominoach
186
10k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
YesSQL, Process and Tooling at Scale
rocio
170
14k
Agile that works and the tools we love
rasmusluckow
328
21k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Music & Morning Musume
bryan
46
6.3k
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