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

Pytest-xdist: tearDown after all workers finish

When I'm running pytest normally it works perfectly fine (before first test it's upgrading migration and after last test it's downgrading migration). Without using xdist I can just set fixture scope='session' and its work that way. But when I run…
2
votes
1 answer

Accessing shared resource across master and worker nodes using pytest-xdist

I'm trying to share a list of random entries from a database (my definition of a shared resource) across master and worker nodes and parallelize tests using pytest-xdist. My code follows the structure below: ## in conftest.py def get_db_entries(): …
Bhushan
  • 590
  • 1
  • 7
  • 23
2
votes
1 answer

Is pytest-xdist thread safe with singleton

I'm bootstrapping a new Selenium project using Python. Coming from the Java world, I used to wrap the Webdriver instance within a ThreadLocal. This way I'm sure when my tests are run in parallel with TestNG, my Webdriver sessions will be isolated…
tetienne
  • 369
  • 3
  • 13
2
votes
2 answers

Pytest xdist and parametrized tests is performing setup per each thread?

I have a test file that I run with pytest The file has parametrized tests and also a setup that I want it to run only once before any of the tests run, on that setup I do actions that can't be done in parallel (Write to text files). That setup is…
David Fliguer
  • 385
  • 1
  • 4
  • 13
2
votes
1 answer

Is it possible to print xdist gateway number to each line in stdout?

I am using logging module to print to stdout. It is hard to understand what message corresponds to worker when I run tests with pytest-xdist Is it possible to print xdist gateway number to each line in stdout? Example of log messages that I have…
Vadim Kovrizhkin
  • 1,575
  • 4
  • 16
  • 27
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
2
votes
0 answers

pytest distributed testing xdist by class

Currently I am running tests as follows: py.test test.py -s -v -d --tx 3*popen which distributes all the pytest test functions we have among 3 python processes. class TestClass(): def test_1(): pass def test_2(): pass …
stihl
  • 241
  • 2
  • 6
  • 16
1
vote
0 answers

Is there a way to control how tests are distributed with pytest --dist loadfile and loadscope

I am trying to figure out if there is a way I can control/ understand how the tests are distributed between different workers when I use the --dist=loadfile or loadscope feature. The structure of my project is tests tests_a.py . . …
1
vote
0 answers

pytest-xdist manage the file order

I have 10 test files: sc0 - run 4 min sc1 - run 6 min sc2 - run 6 min sc3 - run 25 min sc4 - run 25 min sc5 - run 5 min sc6 - run 5 min sc7 - run 5 min sc8 - run 6 min sc9 - run 33 min I use the below command in order to run test in parallel ( each…
Shurik
  • 562
  • 1
  • 7
  • 19
1
vote
1 answer

pytest with workers ( -n 1 for example ) using xdist when test contains also multiprocessing

I'm using Python 3.6 Pytest 6.1.1 Pytest xdist 2.1.0 Pycharm 2018.3.7 Using HTML plugin for report as well with customization for the report I'm running automation test via pycharm >pytest with arguments as below: --html=../../reports/report.html …
ohadshay
  • 225
  • 1
  • 3
  • 16
1
vote
0 answers

Selenium: Running the test suite in parallel (Not cross-browser-testing)

I would like to run a selenium test suite in parallel.(Or distributed mode) (30 tests in the suite, would like 3 threads running in parallel with a total of 30 tests executed when finished, no repeated test) I just want to test against Chrome…
z82 28
  • 11
  • 1
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

How to run pytest-selenium with xdist and use cli arg driver?

I am trying to run multiple tests in parallel using xdist and determine the webdriver based on the user's command line argument such as --driver Remote/Chrome/etc Ultimately, I am trying throw this into docker so that it can be used in a gitlab…
Austin
  • 33
  • 6
1
vote
1 answer

Is there a way to run pytests using xdist by file(s)?

I am trying to run 2 test files using xdist with 2 gateways (-n=2). Each test file contains tests which are user permission specific. While running the test with pytest and pytest-xdist, I noticed some of the test fail randomly. It is happening…
user3435394
  • 11
  • 1
  • 3
1
vote
1 answer

AttributeError: 'Config' object has no attribute 'test_system'

rootdir: python, inifile: pytest.ini, testpaths: test_cases plugins: metadata-1.8.0, html-1.22.0, sugar-0.9.2, timeout-1.3.3, forked-1.0.2, xdist-1.29.0, repeat-0.8.0 timeout: 3600.0s timeout method: signal timeout func_only: False gw0 ok / gw1 ok /…
Kiran
  • 65
  • 2
  • 11