Save 37% off PRO during our Black Friday Sale! »

2017 - Reverb Chu - Concurrent Testing with py.test

Db2ee812bdc6fd057f8f4209c08b6f63?s=47 PyBay
August 13, 2017

2017 - Reverb Chu - Concurrent Testing with py.test

Introducing a different way to perform concurrent testing with the py.test framework.

Db2ee812bdc6fd057f8f4209c08b6f63?s=128

PyBay

August 13, 2017
Tweet

Transcript

  1. Concurrent Testing with py.test Reverb Chu, Sr. SWE @ Trend

    Micro James Wang, UGrad CS Student @ Uni. of Washington
  2. https://goo.gl/mxthn3

  3. https://goo.gl/mxthn3 https://www.apple.com/macbook/

  4. https://goo.gl/mxthn3

  5. Current Solutions https://goo.gl/mxthn3

  6. Current Solutions 1. pytest-xdist https://goo.gl/mxthn3

  7. Current Solutions 1. pytest-xdist 2. ...there’s no 2. https://goo.gl/mxthn3

  8. Why Not pytest-xdist? - Designed for test distribution - Only

    support multiprocessing - Not able to do test grouping https://goo.gl/mxthn3
  9. pytest-concurrent life is too short for sequential tests https://goo.gl/mxthn3

  10. 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
  11. Configurable Worker Amount $ pytest --concmode=mthread --concworkers=10 https://goo.gl/mxthn3

  12. Configurable Worker Amount $ pytest --concmode=mthread --concworkers=max https://goo.gl/mxthn3

  13. 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
  14. May ?? I want it... https://goo.gl/mxthn3

  15. May ?? I want it... Jun 20 Intern Onboard https://goo.gl/mxthn3

  16. May ?? I want it... Jul 31 Let’s Do This

    Jun 20 Intern Onboard https://goo.gl/mxthn3
  17. 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
  18. $ pip install pytest-concurrent https://goo.gl/mxthn3 @reverbc @jamesw96