ITADN

Test execution order seemingly cannot be modified

#347Openpodfran 创建于 2025-07-17
P
podfrancommented
When test order is modified with `pytest_collection_modifyitems`, the tests are still executed in alphabetic order of modules. A minimal example: ``` # test_first.py def test_one(): assert True # test_second.py def test_two(): assert True # conftest.py def pytest_collection_modifyitems(items): items[:] = reversed(items) ``` Running this with `pytest` without the plugin indeed executes the tests in the opposite order. After installing the plugin, the order is reverted to alphabetical. I tried `@pytest.hookimpl()` with `trylast=True` and `tryfirst=True` to no avail. pytest==8.3.5 pytest_robotframework==4.3.2
3 条评论