'Pytest-parallel executing test case twice

For parallel execution i am using pytest-parallel, it works but each test cases is executing twice

def test_2():
    assert 2==2

def test_3():
    assert 1 == 1

command used

pytest -v -s test_file.py --workers auto

What auto will do like trigger as many workers as tests (each worker per test case)

and the result

collected 2 items
pytest-parallel: 8 workers (processes), 1 test per worker (thread)

testing_parallel.py::test_2 PASSED
testing_parallel.py::test_2 PASSED
testing_parallel.py::test_3 PASSED
testing_parallel.py::test_3 PASSED

tried with --workers 2

collected 2 items
pytest-parallel: 2 workers (processes), 1 test per worker (thread)

testing_parallel.py::test_2
testing_parallel.py::test_3 PASSED
testing_parallel.py::test_2 PASSEDPASSED
testing_parallel.py::test_3 PASSED

Here only test cases are there but execution is twice for each test case



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source