Skip test that cannot be ran in parallel#1217
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR addresses test reliability issues by conditionally skipping tests that cannot run properly in parallel test environments. The tests in question modify global Django settings and require specific execution order, which is incompatible with pytest-xdist's parallel execution model.
Key changes:
- Skip problematic tests when pytest-xdist is detected via environment variable
- Add os import to support the skipif condition
Comments suppressed due to low confidence (2)
tests/test_fixtures.py:447
- The skip reason message is too brief and doesn't explain why xdist usage is problematic. Consider a more descriptive message like 'Cannot run in parallel - modifies global settings' to help developers understand the constraint.
@pytest.mark.skipif("PYTEST_XDIST_WORKER" in os.environ, reason="xdist in use")
tests/test_fixtures.py:463
- The skip reason message is too brief and doesn't explain why xdist usage is problematic. Consider a more descriptive message like 'Cannot run in parallel - depends on global state from previous test' to help developers understand the constraint.
@pytest.mark.skipif("PYTEST_XDIST_WORKER" in os.environ, reason="xdist in use")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
There are weird tests in
TestLiveServer.test_settings_before/test_settings_restoredthat requiresxdistto not be used. Since they set a global variable, and due to how xdist works, you cannot guarantee the order or the same worker.I'm in two minds about this... My gut tells me to remove this test.. but I want to first get your opinion.