I have a list of test cases in different modules (just showing glimpse here, but in actual the count is around 10). I want pytest to execute these modules in order, First module-a.py, next module-b.py and so on... However, I am aware of ordering the test cases within module which is working perfectly fine.
Our overall application is a kind of pipeline where module-a output is consumed by module-b and so on.. We want to test it completely end-end in defined order of modules.
module-a.py
-----------
import pytest
@pytest.mark.run(order=2)
def test_three():
assert True
@pytest.mark.run(order=1)
def test_four():
assert True
module-b.py
-----------
@pytest.mark.run(order=2)
def test_two():
assert True
@pytest.mark.run(order=1)
def test_one():
assert True
From above code, I want module-a test_four, test_three module-b test_one, test_two to be executed in order.
Currently we are running each of the module with --cov-append, something like below and generating final coverage.
pytest module-a.py
pytest --cov-append module-b.py
Can any one please help with better approach or better method.