How do I order a module to be run last in a session-scope of multiple directories? #69
-
How do I configure pytest-order to run a module in a directory as the last module in a session scope? Thank you.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you just want to order this one module, and not order any tests inside it, you can add an order marker to the last test in that module (either directory_one/test_module2.py import pytest
def test_1():
pass
def test_2():
pass
@pytest.mark.order(-1)
def test_3():
pass and use the module order group scope (see also the last example in the documentation):
If you always want to order module-wise, you may add this option to pytest.ini [pytest]
; order tests first inside modules, order whole modules afterwards
addopts = --order-group-scope=module If you don't add any other order markers, your tests will be executed in the same order as without ordering, except that all tests in There is currently no possibility to prevent ordering inside the module, so you have to put the marker on the test you want to be executed last inside the module (if the execution order matters at all). |
Beta Was this translation helpful? Give feedback.
If you just want to order this one module, and not order any tests inside it, you can add an order marker to the last test in that module (either
pytest.mark.order(-1)
orpytest.mark.order("last")
):directory_one/test_module2.py
and use the module order group scope (see also the last example in the documentation):
If you always want to order module-wise, you may add this option to
pytest.ini
:pytest.ini
If you don't add any…