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
130
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
810
2017 - Building Bridges: Stopping Python 2 without damages
pybay
0
570
2017 - Bringing Python 3 to LinkedIn
pybay
1
500
2017 - Python Debugging with PUDB
pybay
0
570
2017 - Opening up to Open Source
pybay
0
200
2017 - A Gentle Introduction to Text Classification with Deep Learning
pybay
2
150
2017 - Performant Asynchronous Programming at Quora
pybay
1
320
2017 - latus - a Personal Cloud Storage App written in Python
pybay
2
440
2017 - Everything You Ever Wanted to Know About Web Authentication in Python
pybay
3
490
Other Decks in Programming
See All in Programming
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
0
120
The Shape of a Service Object
inem
0
520
ドメイン駆動設計を実践するために必要なもの
bikisuke
4
330
令和トラベルにおけるLLM活用事例:社内ツール開発から得た学びと実践
ippo012
0
210
Modern Angular with the NGRX Signal Store New Rules for Your Architecture @BASTA! 2024 in Mainz
manfredsteyer
PRO
0
150
Swiftコードバトル必勝法
toshi0383
0
170
事業フェーズの変化に対応する 開発生産性向上のゼロイチ
masaygggg
0
200
rails_girls_is_my_gate_to_join_the_ruby_commuinty
maimux2x
0
200
Regular Expressions, REXML, Automata Learning
makenowjust
0
220
Using Livebook to build and deploy internal tools @ ElixirConf 2024
hugobarauna
0
250
XStateでReactに秩序を与えたい
gizm000
0
730
How to Break into Reading Open Source
kaspth
2
210
Featured
See All Featured
Music & Morning Musume
bryan
46
6k
What's new in Ruby 2.0
geeforr
340
31k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Facilitating Awesome Meetings
lara
49
5.9k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.6k
Designing Experiences People Love
moore
138
23k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
5
480
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
278
13k
Producing Creativity
orderedlist
PRO
340
39k
RailsConf 2023
tenderlove
28
810
WebSockets: Embracing the real-time Web
robhawkes
59
7.3k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
29
2.6k
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