Skip to content

make tests parallelizable (multi processing) using pytest-xdist #2899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2017

Conversation

fmoor
Copy link
Contributor

@fmoor fmoor commented May 23, 2017

Be ware that running tests in parallel may cause tests to flake.
This commit does not make parallel test the default it only makes it possible.

usage

tox -- -n 4

Benchmarking

using the following command ( on my old laptop...)

time tox -e py27 -- -n 6 --ignore=rtd_tests/tests/test_celery.py

w/o xdist: 1 min 24 seconds
2 processes: 53 seconds
3 processes: 44 seconds
4 processes: 40 seconds
5 processes: 40 seconds (tests flake)
6 processes: 43 seconds (tests flake)

~ 2x speedup!

Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

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

Interesting addition. I know we likely have a number of tests that have a side effect of relying on other test state, so it doesn't surprise me that tests fall over if executed in more rapid succession.

docs/install.rst Outdated
.. note::

Some unit tests depend on Hg (mercurial).
Be sure that Hg is `installed <https://www.mercurial-scm.org/wiki/Download>`_ if you want to see all the tests pass.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to address the mercurial change separately, could this be rebased out?

Copy link
Contributor Author

@fmoor fmoor May 24, 2017

Choose a reason for hiding this comment

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

The mercurial change was not supposed to be in there. It might me in all of my recent PRs :(
I am not having initial success with rebasing. Its not something I do often :/ I'll continue to work on it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy to jump in and help if its faster. If you want any guidance on this, I'm happy to pair as well -- feel free to drop by https://gitter.im/rtfd/readthedocs.org if you'd like to set something up

 Be ware that running tests in parallel may cause tests to flake.
 This commit does not make parallel test the default it only makes it possible.
@fmoor fmoor force-pushed the feature/faster_tests branch from 5eabb5f to 4bfefd4 Compare May 24, 2017 19:54
@agjohnson agjohnson merged commit cbec8dd into readthedocs:master May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants