-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix passenv CI in tox ini and make tests insensitive to the presence of the CI env variable #13684
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
base: main
Are you sure you want to change the base?
Conversation
@webknjaz CI is green again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'll let @RonnyPfannschmidt merge since he was active in the related PR.
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
@RonnyPfannschmidt if you have a few minutes to finalize this review, that would be very appreciated as it would unlock my work to finalize #13679. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good
Tho only nitpick that comes to mind is that it could be more declarative
But thats a low hanging fruit followup
def test_error_messages_with_different_verbosity( | ||
self, assert_approx_raises_regex, monkeypatch: MonkeyPatch | ||
): | ||
monkeypatch.delenv("CI") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we want to remove this env var for all tests, correct?
If so, I suggest you add this autouse fixture to conftest.py
:
@pytest.fixture(autouse=True)
def remove_ci_env_var(monkeypatch: MonkeyPatch) -> None:
"""
Make the test suite insensitive if it is running in CI or not.
If a test requires the variable, it should set it explicitly.
"""
monkeypatch.delenv("CI", raising=False)
Then you can revert the changes done to the tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we might want to use this env var in #13679 to use a longer timeout value in some tests to decrease likelihood of failure on slow CI runners.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be more specific: there is an existing test named test_timeout
in test_faulhandler.py
that relies on the presence of this variable to adjust the value of the timeout to make it less likely to fail in case the CI runner is too slow (see #7022). However, this strategy never worked as intended because the CI
variable propagation was always blocked by the existing configuration in tox.ini
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wasn't sure what the impact would be in other places so I didn't suggest making it an autouse fixture.
See: #13679 (comment)