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
2
votes
1 answer

pytest-xdist results in AttributeError: 'dict' object has no attribute 'style'

Currently using allure-pytest-adaptor 1.7.8, pytest 3.2.1 and pytest-xdist 1.20.0 Having the issue when I use the xdist to run tests in parallel, if I ran tests all in serial, no such issue: If there is only 1 or no failures, allure report is able…
Bing Bai
  • 21
  • 3
1
vote
1 answer

Run multiple pytest file parallelly

In my parent folder there is a subfolder tests and all pytest files are inside these. For example ..../tests/test_abc.py .../tests/test_xyz.py There are about 8 to 10 test cases in each of the pytest files. I want to run both these files parallelly…
1
vote
1 answer

Pytest with multiprocessing lock not working as expected when running tests in parallel

I am trying to run my pytests in parallel using the pytest plugins parallel-0.1.1 and xdist-3.2.1 along with the --tests-per-worker n flag. I have a set of tests that require a preprocessing step which must be run in a critical section. This section…
user75453
  • 51
  • 6
1
vote
0 answers

How can I debug a pytest test running in parallel with pytest-xdist?

I have a test that is parameterized that is only failing when running in parallel, so I want to be able to run it and to put a breakpoint and start debugging when it reaches a certain portion of the code. My problem is that PyCharm Pro 2023.1 isn't…
Ben
  • 21
  • 2
1
vote
0 answers

How can I synchronize and join pytest-xdist workers?

I have a set of pytest tests that I run on multiple remotely-connected (embedded) devices (that do not have pytest on itself). Basically, the tests secure-copy (via scp) an update image to each device, installs it running bash commands on the target…
tronic
  • 220
  • 1
  • 10
1
vote
0 answers

Is it possible to construct automation framework with Selenium+docker, without selenium grid but with Pytest Internal parallel execution system?

Currently, I have an automation framework that consists of the following stack: Python Pytest Framework (and pytest-xdist parallel mechanized) Selenium Allure report system Jenkins I'm going to add a docker containerization system as well, to run…
dima edunov
  • 59
  • 1
  • 9
1
vote
0 answers

--cache-clear for pytest xdist

The goal: I need to setup some random value in pytest cache before test collection. The problem: If I run tests in parallel using pytest-xdist with --cache-clear option master and each worker will clear the cache so I need to make sure that all…
1
vote
1 answer

Write to same file in pytest multiprocessing

There is a pytest test suite that gets run in multiprocess/parallel via pytest-xdist. Some of these tests write to the same file, which can become problematic when multiprocessing. I thought that doing something like this would do the trick, but…
hainabaraka
  • 595
  • 2
  • 5
  • 13
1
vote
1 answer

Pytest-xdist does not honour settings.DATABASES (or I am doing something wrong)

I am trying to use pytest-xdist for running parallel tests. It works and I see improved performance. To improve further more, I wanted to provide it multiple databases by using django_db_modify_db_settings_xdist_suffix I override that functions in…
lllrnr101
  • 2,288
  • 2
  • 4
  • 15
1
vote
1 answer

In pytest-html, is there a way to combine html reports of 2 different pytest runs?

Basically i have scenario where i need to run set of parallel pytests and another set of serial pytests separately. Each will generate separate pytest-html reports. But i am looking for solution to combine both the reports generated. Eg: py.test -n…
1
vote
0 answers

How to specify the number of cores to use for each test in pytest?

I am using pytest-xdist to parallelize my tests. The machine I am working on has 12 cores. Half of my tests use 2 processes in each test, while the other half of the tests only use one process (normal single processing). Currently I add the addopts…
Justin Furuness
  • 685
  • 8
  • 21
1
vote
1 answer

Pytest-xdist throwing AssertionError when remote module has pytest_collection_modifyitems()

I have a remote script that needs to be executed by xdist, which I am giving through the hook pytest_xdist_getremotemodule(), I am performing some collection changes, that are common to all nodes through pytest_collection_modifyitems(), but during…
Akhilesh R
  • 11
  • 1
1
vote
0 answers

Decreasing pipeline execution time for python testing phase

Appreciate your support as I need to decrease the pipeline execution time for running python test cases It takes 3 minutes or less via my local machine but 8 minutes or more via pipeline machine Local machine processor Intel(R) Core(TM)…
1
vote
1 answer

Pytest x-dist INTERNALERROR when trying to run tests on remote Windows host using ssh

I have Ubuntu host with environment: Python 3.6.9, pytest-4.6.9, execnet 1.7.1, x-dist 1.31.0 and Windows host: Windows Version 10.0.19041.508, python 3.7.5, pytest 5.4.1, execnet 1.7.1 I want to run tests on Windows host from Ubuntu, using x-dist…
1
vote
0 answers

Pytest with xdist not printing logs for all tests

I wrote a port scanner test using pytest. It receives a json file with a list of ip addresses and then runs the test for each ip address using parametrize. A log file is created with custom log messages using the Python logging module. I can also…
Aron S
  • 121
  • 6