Closed emavgl closed 1 year ago
Could https://github.com/tarpas/pytest-testmon/blob/main/testmon/pytest_testmon.py#L408 be the cause of the problem? Is this sorting actually necessary? @tarpas If not necessary, I would suggest to remove it, since there could be test-suites that depends on test-ordering.
I'm sorry but reordering tests is main feature of testmon and will become more prominent in the next release. In many projects we'll not be able to conclusively filter tests, so testmon will strive to come to failure quickly and end the execution after the first or a couple of failures.
I'm of two minds about the tradeoffs of some kind formal test dependency specification (e.g. via pyteset-dependency). Feel free to open a feature request about a support for that and also what rationale do you have to go agains first principle of automated tests (independence).
Hello again, I have a problem related to dependent tests
In this case, there is a dependency between tests.
test_load_table
writes a file, that is then read by the methodtest_gold_table_after_batch_1
(I know it is best practice having independent tests, but I am trying to simply a more complex use case).We usually run
that respect the execution order of the tests in the same file. The first run:
Assuming now we change both method in the class:
I expect the previous tests to be selected and run in the following order:
However, if I run
The order of the two tests is inverted. Resulting in my testsuite to fail because the data were not loaded:
I am thinking, it would be also helpful, to have a flag in testmon, to force the run of every tests in the same file. Because if I have tests with dependencies, like in this case, and just
test_gold_table_after_batch_1
is selected to run, it will fail because it needstest_load_table
test to be executed first.Hopefully I am not missing any step. Thank you again for your help and your work!