Skip to content

Skip test that cannot be ran in parallel #1217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 2, 2025
Merged

Skip test that cannot be ran in parallel #1217

merged 3 commits into from
Aug 2, 2025

Conversation

kingbuzzman
Copy link
Member

@kingbuzzman kingbuzzman commented Jun 5, 2025

There are weird tests in TestLiveServer.test_settings_before/test_settings_restored that requires xdist to 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.

@kingbuzzman kingbuzzman marked this pull request as ready for review June 5, 2025 23:08
@kingbuzzman kingbuzzman requested review from bluetech and Copilot June 5, 2025 23:08
Copilot

This comment was marked as outdated.

@kingbuzzman kingbuzzman requested a review from Copilot August 1, 2025 14:30
Copilot

This comment was marked as outdated.

@kingbuzzman kingbuzzman requested a review from Copilot August 1, 2025 14:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

@kingbuzzman kingbuzzman merged commit 55b8cc8 into main Aug 2, 2025
21 checks passed
@kingbuzzman kingbuzzman deleted the dev/xdist-skip branch August 2, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant