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

What is the difference between Selenium Grid and pytest-xdist plugin?

I'm new to parallel testing and I was wondering what the difference is between them. Apparently, pytest-xdist does not need Selenium Grid to run. It can be used with Selenium alone. Does anybody have any clue or resource where I can learn the…
0
votes
0 answers

pytest-xdist: How to execute a method (where I initialize DB mocks for all the tests in that file) before the test methods are executed

I have a test suite that used to be executed with pytest and I used the method before_all_tests(request) in each test file to initialize the db mockups for those tests. I wanted to use pytest-xdist to run them parallelly, but…
0
votes
1 answer

How to disable pytest xdist only when pytest is called with filters?

When I run all pytests I do want to fully benefit from spreading the load on all m cores (xdist) but when I run a subset of them is almost always for development/debugging purposes, case in which I do want to avoid the downsides of xdist as: slower…
sorin
  • 161,544
  • 178
  • 535
  • 806
0
votes
0 answers

Pytest, change counter that is passed to markers dynamically

I am reading my test data from a Python file as follows. //testdata.py -- its a list of sets. TEST_DATA = [ ( {"test_scenario":"1"}, {"test_case_id":1} ), ( {"test_scenario":"2"}, {"test_case_id":2} ) ] Now I use this test data as part of a pytest…
Rekha R
  • 131
  • 1
  • 1
  • 12
0
votes
0 answers

Can we run multiple marker in parallel?

I have a python script and say I have 10 test cases in it. 5 are part of marker1 and another 5 are part of marker2. I want to start 2 threads in parallel so marker1 tests can run in 1 thread and marker2 tests can run in another. And my execution…
0
votes
3 answers

Why is pytest asking to specify --tx

After multiple successful tests, pytest is suddenly throwing this error: $ pytest -vvv -x --internal --oclint -n -32 ============================= test session starts ============================== platform darwin -- Python 3.7.7, pytest-5.4.1,…
Ross Jacobs
  • 2,962
  • 1
  • 17
  • 27
0
votes
1 answer

pytest xdist plugin is running unconventionally with pytest_addoption hook

I am running pytest_addoption hook along with pytest xdist plugin def pytest_addoption(parser): parser.addoption("--env", action="append", default=[], help="list of env's to pass to test functions") def pytest_generate_tests(metafunc): if…
Bharath Kashyap
  • 343
  • 2
  • 5
  • 14
0
votes
1 answer

How to execute pytest paralelly through xdist plugin?

How can I run my pytests parallely on multiple custom environments ? I have pytest-xdist as well. Not sure if this plugin helps test_test.py @pytest.mark.env("env1", "env2", "env3") def test_check(env): print("Chosen {} for test_check…
Bharath Kashyap
  • 343
  • 2
  • 5
  • 14
0
votes
2 answers

How can I adjust the number of threads with pytest + xdist?

To run parallel tests on mobile devices, I use pytest + xdist. I want to run as many threads as I have connected devices, no more. I pass "-n 4" as command line argument, but I can't change it after test launch if I need 2 threads, not 4. How can I…
lunin
  • 51
  • 6
0
votes
1 answer

pytest-xdist generate random & uniqe ports for each test

I'm using pytest-xdist plugin to run some test using the @pytest.mark.parametrize to run the same test with different parameters. As part of these tests, I need to open/close web servers and the ports are generated at collection time. xdist does the…
Amir Rossert
  • 1,003
  • 2
  • 13
  • 33
0
votes
2 answers

Can pytest xdist tests log to the same configuration?

I'm using pytest with the xdist plugin to run a large suite of tests. These tests can take a few hours to run, so I'd like to see certain information while they are running. The items I'd like to see are the errors when tests fail, how many tests…
user197674
  • 748
  • 2
  • 7
  • 22
0
votes
0 answers

pytest xdist and setup hook execution

I am having trouble getting my plugin pytest_runtest_setup hook executing with xdist plugin. It executes without specifying -n option, but as soon as I specify that option the hook doesn't execute. My pytest_runtest_makereport always works. Any…
Aaron
  • 3,249
  • 4
  • 35
  • 51
0
votes
1 answer

Trying to understand pytest-xdist failures for parametrized tests

I have some parametrized tests that use a fixture defined in conftest. My tests are failing when pytest-xdist is used but pass with standard pytest. The fixture creates a directory which is then used by the test and I'm getting IOErrors. From the…
jasmine
  • 115
  • 1
  • 1
  • 6
1 2 3 4 5
6