-
-
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
Merged
+20
−2
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6f89a1c
MAINT passenv CI in tox.ini
ogrisel e33850b
MAINT make tests insensitive to the presence of the CI env var
ogrisel 1b5f077
Make test_line_with_reprcrash CI insensitive
ogrisel e3f4dad
Document change in the changelog
ogrisel c1976ad
Make test_error_messages_with_different_verbosity CI insensitive
ogrisel 1efb477
Update changelog/13684.contrib.rst
ogrisel c34d9b5
Factorize monkeypatch.delenv('CI', raising=False) into remove_ci_env_…
ogrisel ef78906
Make enable autouse on the remove_ci_env_var fixture + add a marker t…
ogrisel 1ce85ea
Re-add the skip mark on test_timeout
ogrisel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Make pytest's own testsuite insensitive to the presence of the ``CI`` environment variable -- by :user:`ogrisel`. |
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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
: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
intest_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 theCI
variable propagation was always blocked by the existing configuration intox.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.
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 will update the PR to introduce the fixture but not make it auto-use for now.
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.
@nicoddemus @webknjaz @RonnyPfannschmidt done in c34d9b5.
Once merged, I can follow up with a PR to update
test_timeout
to remove the skip marker and then trigger the tests on the CI a few times in a row to check that it can properly fix #7022 without having to skip the test entirely on the CI. Then I will update #13679 accordingly.Uh oh!
There was an error while loading. Please reload this page.
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.
Ahh I see.
In that case we could then create a new mark that skips deleting the env var if present in a test.
We can apply this mark to
test_timeout
and any other test that requires seeing the realCI
variable.@ogrisel I understand this is PR is a side quest just to work on #13679, but would mind give the autouse fixture a go? I think the time to try this approach is now that we have someone on hands on the issue.
If there are too many breakages and you decide to not deal with them now, feel free to revert the
autouse
change and merge as is currently.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'm leaving pre-approved. Would appreciate you giving the autouse approach one more try before merging though.
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.
Alright, let me give this a try.