-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
monkeypatch.delattr(os, 'environ')
causes tests to be unrunnable
#3352
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
Labels
type: bug
problem that needs to be addressed
Comments
its a kind of known issue we plan to eventually do imports from the stdlib in a way that protects pytest from 3rd party monkeypatching, as all kinds of libs do all kinds of fun issues i dont have the other issue readyly at hand |
See #3290 |
Should we close this as a duplicate? |
yeah I think so -- this is a good concrete example, but that ticket definitely covers the expected behaviour here :D |
Thanks @asottile! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was debugging the tests of procfs and noticed a very strange bit of code. I've boiled it down to a minimal reproduction.
The odd bit here is this code works in pytest 3.1.3 (the newest version I could find that works).
sample code
pytest 3.5.0 (current)
pytest 3.1.3 (older)
failure for
procfs
The failure mode for procfs was much worse (probably due to deleting many more things from the
os
module) to the point where it was nearly impossible to know what was happening:wat
I realize this example is super-contrived and probably not something that should be supported. Honestly I was more surprised that it worked previously.
Here's a patch that "fixes" this, though I imagine any other module could be broken in the same way:
Command I used to "bisect" the problem (I didn't actually bisect, it was fast enough to just try every version):
followup
The text was updated successfully, but these errors were encountered: