Skip to content
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

tests: reset global state before each test #6101

Merged
merged 2 commits into from
May 14, 2024

Conversation

oliver-sanders
Copy link
Member

Should help to resolve possible issues where one test sets a flag (but not via monkeypatch) and another accesses that value.

@oliver-sanders oliver-sanders added this to the 8.3.0 milestone May 14, 2024
@oliver-sanders oliver-sanders self-assigned this May 14, 2024
def test_reset(monkeypatch):
"""Reset global state before all tests."""
monkeypatch.setattr('cylc.flow.flags.verbosity', 0)
monkeypatch.setattr('cylc.flow.flags.cylc7_back_compat', False)
Copy link
Member

@MetRonnie MetRonnie May 14, 2024

Choose a reason for hiding this comment

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

How about setting the flags directly?

tests/conftest.py Outdated Show resolved Hide resolved
Copy link
Member

@MetRonnie MetRonnie left a comment

Choose a reason for hiding this comment

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

This seems to do the trick

@MetRonnie MetRonnie merged commit a5e598b into cylc:master May 14, 2024
25 checks passed
@oliver-sanders oliver-sanders deleted the tests-reset-flags branch May 14, 2024 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants