CI: network tests running even with "not network" #43545
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.
While looking into windows timeouts, noticed network tests were still being run with -m "not network".
tm.network
adds the keywordnetwork
, but does not add a mark, so -m "not network" was still running network tests. While a mark could probably be set somehow in that decorator, I couldn't find apytest
documented way to do that.Instead, this pushes
pytest_runtest_setup
intopytest_collection_modifyitems
(which I think is more intuitive since we know if a test should be skipped or not at collection time, and shouldn't need these skip checks at setup-time for each test).The other reason for this change was that
pytest_runtest_setup
is too late in the pipeline to add the network marker. By moving the skip logic topytest_collection_modifyitems
, we can consolidate the skip checks with adding the corresponding marker if the "network" keyword is found.