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

74 questions
54
votes
6 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
  • 3,007
  • 3
  • 19
  • 10
30
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
  • 335
  • 1
  • 3
  • 6
25
votes
2 answers

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
  • 4,581
  • 3
  • 30
  • 32
21
votes
3 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
  • 6,506
  • 4
  • 35
  • 58
11
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…
Gababi
  • 141
  • 1
  • 2
  • 7
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
  • 25,042
  • 81
  • 346
  • 663
8
votes
2 answers

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,640
  • 2
  • 23
  • 36
7
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
  • 5,197
  • 2
  • 42
  • 46
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
0 answers

Why does pytest_sessionstart hook run multiple times when using pytest-xdist?

Im trying to run pytests in parallel across my selenium grid using pytest-xdist. Prior to using pytest-xdist, I had one time setup being executed once before all tests even started using the pytest_sessionstart hook. It worked perfectly. It would be…
JerryBringer
  • 150
  • 1
  • 1
  • 8
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,656
  • 1
  • 21
  • 30
5
votes
0 answers

Serialization Issue in Pytest/xdist

Replacing crashed worker gw0 INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/local/lib/python3.7/site-packages/_pytest/main.py", line 191, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or…
NJN
  • 79
  • 8
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
  • 195
  • 1
  • 11
5
votes
2 answers

How to modify pytest arguments?

I found out for this purpose I can use PyTest function pytest_load_initial_conftests() https://docs.pytest.org/en/latest/example/simple.html#dynamically-adding-command-line-options But I can't implement this example (see link)…
lunin
  • 51
  • 6
5
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
  • 394
  • 5
  • 9
1
2 3 4 5