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 as executing one after another it's taking a lot of time, to execute 20 cases.
You specifically want to use the
--dist=loadfilearg ofpytest-xdistin order to split tests in parallel via file. From the documentation:Tests are grouped by their containing file. Groups are distributed to available workers as whole units. This guarantees that all tests in a file run in the same worker.So you would first
pip install pytest-xdist, and then run your tests like this: