Skip to content

Commit

Permalink
Unparallelize pytest for Python 3.5 everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Oct 20, 2018
1 parent fb783f1 commit 1778189
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ jobs:
- &env_py35 PYTHON_VERSION=3.5.3
- *env_pyenv
- *env_path
- PYTEST_ADDOPTS=-n0
- <<: *osx_python_base
python: *mainstream_python
env:
Expand Down Expand Up @@ -236,6 +237,7 @@ jobs:
- *env_py35
- *env_pyenv
- *env_path
- PYTEST_ADDOPTS=-n0
# OS X 10.10, Python 3.6
- <<: *osx_pypi_deploy_base_1010
env:
Expand All @@ -258,6 +260,7 @@ jobs:
- *env_py35
- *env_pyenv
- *env_path
- PYTEST_ADDOPTS=-n0
# OS X 10.11, Python 3.6
- <<: *osx_pypi_deploy_base_1011
env:
Expand All @@ -280,6 +283,7 @@ jobs:
- *env_py35
- *env_pyenv
- *env_path
- PYTEST_ADDOPTS=-n0
# OS X 10.12, Python 3.6
- <<: *osx_pypi_deploy_base_1012
env:
Expand Down

14 comments on commit 1778189

@kxepal
Copy link
Member

@kxepal kxepal commented on 1778189 Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@webknjaz Which problems this causes? Referenced PR looks wrong.

@webknjaz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kxepal try it locally under 3.5 with -n auto and you will see :)

@webknjaz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kxepal
Copy link
Member

@kxepal kxepal commented on 1778189 Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2339 passed, 31 skipped, 3 xfailed in 50.38 seconds

Python 3.5.5, current master, no any issues noticed.

@webknjaz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the log above

@webknjaz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a leftover from #2991, where I did this for Linux job only

@kxepal
Copy link
Member

@kxepal kxepal commented on 1778189 Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Thanks!

@webknjaz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kxepal your excerpt looks like you used a single worker. For me (under 3.7) the time was reduced from 60s to 18s. How exactly did you run that? Show me starting output up to the testing start.

@kxepal
Copy link
Member

@kxepal kxepal commented on 1778189 Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did naive

pytest -nauto tests/

it spawn 4 workers for me if I get it right

$ pytest -nauto tests/
=== ... snip ... ===
platform linux -- Python 3.5.5, pytest-3.9.1, py-1.7.0, pluggy-0.8.0 -- /home/kxepal/projects/aio-libs/aiohttp/venv/bin/python3.5
cachedir: .pytest_cache
rootdir: /home/kxepal/projects/aio-libs/aiohttp, inifile: setup.cfg
plugins: xdist-1.23.2, mock-1.10.0, forked-0.2, cov-2.6.0
[gw0] linux Python 3.5.5 cwd: /home/kxepal/projects/aio-libs/aiohttp
[gw1] linux Python 3.5.5 cwd: /home/kxepal/projects/aio-libs/aiohttp
[gw2] linux Python 3.5.5 cwd: /home/kxepal/projects/aio-libs/aiohttp
[gw3] linux Python 3.5.5 cwd: /home/kxepal/projects/aio-libs/aiohttp
[gw0] Python 3.5.5 (default, May  3 2018, 17:08:23)  -- [GCC 7.2.0]
[gw1] Python 3.5.5 (default, May  3 2018, 17:08:23)  -- [GCC 7.2.0]
[gw2] Python 3.5.5 (default, May  3 2018, 17:08:23)  -- [GCC 7.2.0]
[gw3] Python 3.5.5 (default, May  3 2018, 17:08:23)  -- [GCC 7.2.0]
gw0 [2373] / gw1 [2373] / gw2 [2373] / gw3 [2373]
scheduling tests via LoadScheduling

tests/test_base_protocol.py::test_pause_writing 
tests/test_base_protocol.py::test_loop 
tests/test_base_protocol.py::test_default_loop 
tests/test_base_protocol.py::test_resume_writing_no_waiters 
[gw1] [  0%] PASSED tests/test_base_protocol.py::test_loop 
[gw3] [  0%] PASSED tests/test_base_protocol.py::test_default_loop 
[gw0] [  0%] PASSED tests/test_base_protocol.py::test_pause_writing 
tests/test_base_protocol.py::test_connection_made 
tests/test_base_protocol.py::test_connection_lost_paused_without_waiter 
tests/test_base_protocol.py::test_connection_lost_not_paused 
[gw2] [  0%] PASSED tests/test_base_protocol.py::test_resume_writing_no_waiters 
tests/test_base_protocol.py::test_drain_lost 
[gw3] [  0%] PASSED tests/test_base_protocol.py::test_connection_lost_not_paused 
[gw1] [  0%] PASSED tests/test_base_protocol.py::test_connection_made 
tests/test_base_protocol.py::test_drain_not_paused 
tests/test_base_protocol.py::test_resume_drain_waited 

@kxepal
Copy link
Member

@kxepal kxepal commented on 1778189 Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I got an error, but different one by installing uvloop.

Different tests were collected between gw0 and gw1. The difference is:

...the differrence is the very long list. gw are always random, but always any two.

@webknjaz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah.. you've got 4-core machine w/o HT. Makes sense. My Lenovo P50 runs 8 workers with auto. Anyway, in all of envs I've got it to run under Python 3.5 lots of tests failed with ResourceWarning: unclosed event loop, which might be related to some OS constraints, but is only reproducible under Python 3.5. So if you know how to cure that, send a PR.

@webknjaz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kxepal that error can be fixed by setting PYTHONHASHSEED env var to some value, so that all workers would have the same seed.

@webknjaz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kxepal
Copy link
Member

@kxepal kxepal commented on 1778189 Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PYTHONHASHSEED helped, thanks!

Unlikely I can cure what I cannot reproduce, I just was wondering about the issue. Thank you for references and detailed explanation!

🍺

Please sign in to comment.