Questions tagged [xdist]

PyTest xdist is a plugin that allows parallel and distributed execution of unittests.

PyTest xdist is a plugin that allows parallel and distributed execution of unittests.

http://pytest.org/latest/xdist.html

67 questions
43
votes
5 answers

Is there a way to control how pytest-xdist runs tests in parallel?

I have the following directory layout: runner.py lib/ tests/ testsuite1/ testsuite1.py testsuite2/ testsuite2.py testsuite3/ testsuite3.py testsuite4/ …
superselector
  • 1,647
  • 3
  • 14
  • 10
21
votes
1 answer

How to print output when using pytest with xdist

I'm using py.test to run tests. I'm using it with pytest-xdist to run the tests in parallel. I want to see the output of print statements in my tests. I have: Ubuntu 15.10, Python 2.7.10, pytest-2.9.1, pluggy-0.3.1. Here's my test file: def…
Steve Saporta
  • 3,672
  • 2
  • 26
  • 30
20
votes
7 answers

pytest: How to get a list of all failed tests at the end of the session? (and while using xdist)

I would like to have a list of all the tests that have failed to be used at the end of session. Pytest lets you define a hook pytest_sessionfinish(session, exitstatus), that is called at the end of the session, where I wish to have that list.…
Itay
  • 235
  • 1
  • 2
  • 6
17
votes
2 answers

Why does pytest + xdist not capture output?

I'm using pytest with pytest-xdist for parallel test running. It doesn't seem to honour the -s option for passing through the standard output to the terminal as the tests are run. Is there any way to make this happen? I realise this could cause the…
Andrew Magee
  • 5,913
  • 4
  • 31
  • 56
10
votes
2 answers

No output, even with `py.test -s`

I would like to use py.test combined with hunter: PYTHONHUNTER="module_startswith='foo'" py.test -s -k test_bar Unfortunately the output (trace) of hunter is not visible. Version: foo_cok_d@aptguettler:~$ py.test --version This is pytest version…
guettli
  • 26,461
  • 53
  • 224
  • 476
7
votes
0 answers

Py.Test hangs on timeout when running parallel tests with xdist

I've recently started using pytest to run my automated test suite. Test runs that were completing successfully when run sequentially, are now failing randomly when I use xdist to run the suite in parallel. I have pytest configured as…
6
votes
3 answers

pytest fixtures and threads synchronizations

I'm trying to use pytest-xdist in order to make my tests run parallel, The issue is that each thread is going to the fixture that shared to all tests and executing it according to threads number. It cause me an issue because that fixture role is to…
GabiJava
  • 61
  • 2
  • 6
6
votes
1 answer

pytest-xdist: LookupError: setuptools-scm was unable to detect version

When installing pytest-xdist, I'm getting this error: Collecting pytest-xdist>=1.15.0 Downloading https://company.com/pypi/packages/dc/b2/a59db3ef996b93c3ef35dbbc33557a71ef67a6839d94a52c88eeb1086002/pytest-xdist-1.15.0.tar.gz (87kB) 100%…
yndolok
  • 4,689
  • 2
  • 35
  • 37
6
votes
4 answers

Pytest doesn't recognize -n option after pytest-xdist installation

I have installed pytest-xdist on top of a working pytest environment : pip install pytest-xdist and I have received this output Downloading/unpacking pytest-xdist Downloading pytest-xdist-1.10.tar.gz Running setup.py egg_info for package…
Salvatore Avanzo
  • 2,348
  • 1
  • 15
  • 28
5
votes
1 answer

How to run tests in Pytest in parallel inside the Docker container?

I ran into a problem when running GUI tests in parallel inside a Docker container. I use a bunch: Selenium webdriver + Pytest + Xdist + Chrome. I use following command to run the tests: pytest -v -n=4 --headless=True --production=True…
Sergei
  • 185
  • 9
4
votes
1 answer

pytest - rerun failed test after all other tests

In my scenario, I have one test that writes a file, and one (but potentially many more) tests that would want to read that file. I cannot simply extract writing that file to a function/fixture, because it involves some other fixtures that inside are…
murison
  • 3,008
  • 1
  • 18
  • 28
4
votes
1 answer

Dynamically control order of tests with pytest

I would like to control the order of my tests using logic which will reorder them on the fly, while they are already running. My use case is this: I am parallelizing my tests with xdist, and each test uses external resources from a common and…
brianmaissy
  • 186
  • 1
  • 8
4
votes
2 answers

Using Docker, with Selenium and Pytest to run parallel tests

I'm trying to use these all things together to run parallel tests in a headless chrome: Docker, Selenium, Pytest However, I'm wondering where it makes sense to run the parallel part of the system? Docker can do this (using selenium grid). Both…
Ke.
  • 2,224
  • 5
  • 32
  • 70
4
votes
1 answer

py.test fixture how can I change fixture's scope

I am running tests in two modes: with bare pytest and with pytest-xdist. I have a heavy fixture that was defined with module scope. Inside this fixture, I have some optimization for the case when I am running tests with…
Aleksandr Karasev
  • 387
  • 1
  • 3
  • 12
4
votes
1 answer

How to run setup in each pytest-xdist process

When my test runner starts, I want to set some stuff up (adjust sys.path, add some environment variables, start some global fixtures). What hook can I use to make these changes in each xdist process that is spawned? I've tried overloading a couple…
dbn
  • 10,463
  • 2
  • 50
  • 83
1
2 3 4 5