Skip to content

tests: test_xfail_handling: use sys.dont_write_bytecode #6444

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 1 commit into from
Jan 17, 2020

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Jan 11, 2020

No description provided.

@bluetech
Copy link
Member

One thing to worry about when modifying globals like sys.dont_write_bytecode even temporarily is that it also affects other concurrent threads. I guess no one runs pytest in multiple threads though, right? It doesn't make much sense with current python. If so, this looks like a nice cleanup to me (though @nicoddemus added this test so they might want to approve).

@blueyed
Copy link
Contributor Author

blueyed commented Jan 14, 2020

@bluetech

sys.dont_write_bytecode

We're using it elsewhere already. See 1abb08d.

"""Ensure normal xfail is ignored, and strict xfail interrupts the session in sw mode

(#5547)
"""
monkeypatch.setattr("sys.dont_write_bytecode", True)
Copy link
Member

Choose a reason for hiding this comment

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

does this still work if one forces subprocess execution? if not you may need to add the env var monkeypatch as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Likely not (as with other places we're doing it).
Might be worth having a method in monkeypatch for handling this in a canonical way, but I think we do not support using --runpytest=subprocess in our test suite currently.

Copy link
Member

Choose a reason for hiding this comment

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

good point, lets make a follow-up issue to later decide the future of that

@blueyed blueyed requested a review from nicoddemus January 14, 2020 11:59
@blueyed
Copy link
Contributor Author

blueyed commented Jan 17, 2020

@nicoddemus
I would assume this is good to go, please ACK.

@blueyed blueyed merged commit e16cb2f into pytest-dev:master Jan 17, 2020
@blueyed blueyed deleted the fix-test_xfail_handling branch January 17, 2020 09:28
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.

3 participants