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
1
vote
1 answer

Get consistent ID for Python script, but different every run

I need a function to generate/return a unique ID in a Python script, but I need it to satisfy a few requirements: Must be different every run Must be the same value within a single run, even if: Multiple classes call it Multiple threads (xdist)…
sprad
  • 313
  • 3
  • 10
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

Pytest setup_method executes before xdist worker_id fixture

Pytest setup_method executes before xdist worker_id fixture is it possible to get worker id before start of setup_method? e.g. I have: Content of conftest.py: @pytest.fixture(autouse=True) def worker_id(request): print("worker") if…
Vadim Kovrizhkin
  • 1,575
  • 4
  • 16
  • 27
1
vote
1 answer

OSX. pytest-xdist error in zsh terminal: zsh: no matches found: 3*popen

I am using ZSH + iterm as a command line tool. When I am trying to run pytest tests with xdist plugin in several subprocesses I get an error: no matches found: 3*popen Execution command: pytest --tx 3*popen --dist=load Additional info: OS version:…
Vadim Kovrizhkin
  • 1,575
  • 4
  • 16
  • 27
1
vote
1 answer

run setup in a subprocess created by xdist

I need to execute some setup (like creating a socket) inside each of the processes created by xdist before the processes start running the tests. I have looked at the hooks provided by xdist, but both pytest_configure_node() and…
user197674
  • 748
  • 2
  • 7
  • 22
1
vote
2 answers

Run part of Python unit tests on remote Linux machine from a Windows host

My situation goes like this: I have a windows-based server program and a linux-based client. I have many tests for the linux clients which run and are required to run on local linux machines I need to run some code from windows server machine which…
vladosaurus
  • 1,638
  • 1
  • 13
  • 18
1
vote
0 answers

How to execute test cases in parallel using xdist plugin?

I have a pytest test suite with three parameterized test cases. I want to execute the three test cases in parallel. The sample test suite looks as follows. ### test_suite.py ### def test_case1(param1, param2): ... def test_case2(param1,…
1
vote
0 answers

Wing IDE pytest: how to integrate and use plugins (e.g. xdist)

The testing tool in Wing IDE (Pro) now supports the pytest unit testing framework. How can I integrate and use pytest plugins, especially xdist? For example, I would like my tests being distributed to multiple CPUs when I run them (triggered from…
langlauf.io
  • 3,009
  • 2
  • 28
  • 45
1
vote
2 answers

py.test with xdist skipping all the tests with -n > 1

My tests take 2 minutes to run: $ py.test ================================================= test session starts ================================================= platform linux2 -- Python 2.7.8 -- py-1.4.24 -- pytest-2.5.2 plugins: cov,…
liori
  • 40,917
  • 13
  • 78
  • 105
1
vote
1 answer

How to properly perform a global fixture with python before running tests multitheded?

I have a set of 200 unit tests which do run ok when executed on a single thread with py.test. I do have a fixture which is configuring a webserver so I can run the tests against it. Still, I need to be sure that this is run only once before all the…
sorin
  • 161,544
  • 178
  • 535
  • 806
0
votes
0 answers

Why Pytest Xdist Plugin Error isn`t working?

screenshotPS C:\Users\мвидео\PycharmProjects\UDEMY-PythonTestAutomationWithPytest> pytest -n auto ================================================================================= test session starts…
Badx
  • 1
  • 1
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

When trying to run parallel tests on same browser I seem to run only 2 max

Here's my command : pytest -v -s -n=4 test_Cases/test_login.py --browser chrome Here's the output: plugins: xdist-3.1.0, html-3.2.0, metadata-2.0.4 [gw0] darwin Python 3.8.0 cwd: /Users/georgeashraf/My- …
0
votes
1 answer

Delayed statement execution and test result without holding testing

(I am a non technical QA so please pardon my technical ignorance) Libraries: pytest==6.2.4 mysql-connector-python==8.0.23 selenium==3.141.0 psycopg2==2.8.6 assertpy==1.1 requests==2.25.1 sshtunnel==0.4.0 (I don't mind switching to another python…
Govinda
  • 582
  • 1
  • 5
  • 14
0
votes
0 answers

xdist showing error while passing object as paramaeter in pytest

INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "c:\users\harshil.gajera\appdata\local\programs\python\python37\lib\site-packages\pluggy\callers.py", line 208, in…