Use pytest_subtests
for grouped tests
#2644
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We use custom xdist scheduler and
xdist_marker
for grouping tests that should run on the same Pytest worker. That is needed e.g. when we want to share expensive setup between several tests.However in some cases this grouping is not enough. Consider hypothetical scenario where we want to reconfigure dbsync and run several tests with the changed configuration. We wouldn't know if the last marked test already finished, and so we don't know when we can return dbsync to its original configuration. We would need to respin the whole cluster instance (using cluster manager). With subtests approach, we can have a single test where a fixture does the setup (reconfiguration) and teardown (back to original) of the dbsync configuration. All the individual tests are just subtests.