Questions tagged [pytest-xdist]

pytest-xdist is a pytest plugin which allows test execution in parallel. Paralellization works both by running a configurable number of processes on the same host, and across multiple hosts. It also supports running tests on multiple platforms and Python interpreters in parallel. Additionally, it supports automatic re-running of failed tests.

Reference:

88 questions
1
vote
0 answers

(Pytest-Xdist) ModuleNotFoundError: No module named 'execnet.rsync'

I have been trying to bundle my tests written on pytest as .exe file. I have tried the code mentioned in the pytest documentation for including the third party plugins: https://docs.pytest.org/en/latest/example/simple.html#freezing-pytest My code is…
1
vote
0 answers

Running a pytest fixture only once when running tests in parallel

I'm having some real difficulty in running a pytest fixture within a conftest file only once when the tests are run in parallel via a shell script. Contents of the shell script are below: #!/usr/bin/env bash pytest -k 'mobile' --os iphone my_tests/…
1
vote
1 answer

Using Pytest, I can't find a way to run 2 test classes at once in parallel, while each class has several tests?

I'm using Pytest, and having the following structure of tests : ClassA.py ---------------test_a ---------------test_b ---------------test_c And Also ClassB.py ---------------test_d ---------------test_e ---------------test_f I'm running my tests…
dima edunov
  • 59
  • 1
  • 9
1
vote
0 answers

Pytest crashes when using json-report and xdist plugins together

I am having an issue with pytest-json-report and pytest-xdist plugins working togehter. Basically, the tests run smoothly when started with these two separatley, so from functional point of view, seems like there is no issue. The problem starts only…
1
vote
0 answers

Could I condition pytest-xdist parallel execution with test dependencies?

I was finding out some kind of combination of pytest-xdist with dependency-related plugins like pytest-dependency (but it seems to have some incompatibilities, better to say, they don't get along), or pytest-ordering with the same problems. What I…
eramos
  • 196
  • 1
  • 16
1
vote
1 answer

pytest-xdist with module-scoped fixture

How many times will the fixture run for: @pytest.fixture(scope="module") def foo(): return True def test1(foo): pass def test2(foo): pass
Nir
  • 21
  • 2
1
vote
2 answers

Storing global configuration data in a pytest/xdist framework

I'm building a test framework using python + pytest + xdist + selenium grid. This framework needs to talk to a pre-existing custom logging system. As part of this logging process, I need to submit API calls to: set up each new test run, set up test…
sprad
  • 313
  • 3
  • 10
1
vote
1 answer

Ruuning conftest before distribution using pytest xdist

Can any one help with a solution for the following requirement. I have to connect to a VM before starting test suite only once for the entire module. And I am successful with that by using Conftest for that suite.But now, I would like to distribute…
user3116988
  • 43
  • 1
  • 4
0
votes
0 answers

When using pytest-html with pytest-xdist plugin ,the report generated does not show screenshot for failed test case

I am executing my set of test cases using pytest-xdist with -n=3, and I am utilizing the --dist loadgroup option. Additionally, I have integrated pytest-html for generating HTML reports.However, I have encountered an issue where the generated report…
Rashmi
  • 1
  • 1
0
votes
1 answer

pytest xdist: different number of tests fail depending on number of workers

I'm using xdist in order to accelerate my pytest execution. Everything seemed to work fine until I recently tried to run pytest with a different number of workers. pytest -n 8 gives 36 failed tests pytest -n 9 gives 37 failed tests pytest -n 11…
Hauptideal
  • 123
  • 5
0
votes
1 answer

Running a test using pytest-xdist is opening several tabs

I have 3 tests as shown in the code below to run in parallel using pytest-xdist. from time import sleep from selenium import webdriver from selenium.webdriver import ChromeOptions port = 4444 command_executor = 'http://127.0.0.1:%s/wd/hub' %…
sridhar249
  • 4,471
  • 6
  • 26
  • 27
0
votes
0 answers

Can we trigger multiple tests in parallel in pytest but with a little time difference

I have created a pytest framework where each test triggers a Jenkins job to deploy some application and then perform some validation. (I am using pytest-jenkins module to trigger a Jenkins build from python) However, when I run these tests in…
Akshay Kane
  • 161
  • 1
  • 2
  • 4
0
votes
0 answers

How can I make sure that tests are not running in the same worker when using pytest-xdist?

Imagine the following 5 tests: from time import sleep import pytest @pytest.mark.xdist_group(name="group1") def test_a() -> None: assert True @pytest.mark.xdist_group(name="group1") def test_b() -> None: assert True def test_c() ->…
doublethink13
  • 633
  • 8
  • 19
0
votes
1 answer

Passing COM Port Numbers to Workers in pytest-xdist

I am trying to parallelize hardware tests across several identical devices, each with its own COM-port. Ideally, I would like each pytest-xdist worker to know which port, and thus, device, that it has access to, so that each process would only…
Filip Kunc
  • 49
  • 6
0
votes
1 answer

Multiple pytest sessions during tests run

I am writing tests using pytest and pytest-xdist and I want to run pytest_sessionstart before all workers start running and pytest_sessionfinish when they are done. I found this solution: link, but this is not working as expected. There are multiple…
maciek97x
  • 2,251
  • 2
  • 10
  • 21