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

Append test plugin packages via monkeypatch.syspath_prepend #666

Merged
merged 2 commits into from
Feb 3, 2021

Conversation

tony
Copy link
Member

@tony tony commented Feb 3, 2021

Fixes #658

  • 1st commit : Applies monkey patch globally to all tests, removes test packages from pyproject.toml

  • 2nd commit : Scopes it to only relevant packages, so unrelated tests don't have sys.path's altered.

    This is optional, but good to ensure explicitness (down the road, implicit alteration of site packages for all tests may be super hard to track down if it leads to an error in tests years from now, so I try to use autouse=True sparingly as possible)

Any thoughts on this approach @joseph-flinn?

Copy link
Contributor

@joseph-flinn joseph-flinn left a comment

Choose a reason for hiding this comment

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

@tony I like this approach much better than what I had. Testing is probably my weakest technical skill and monkeypatch is still a pretty big black box to me.

@tony
Copy link
Member Author

tony commented Feb 3, 2021

@joseph-flinn Then let's give this a shot! I will backport and publish versions for 1.6 and 1.7 to see if that works for #658 (and any other maintainers that bumped into this issue)

@tony tony merged commit 8050d11 into master Feb 3, 2021
tony added a commit that referenced this pull request Feb 3, 2021
@tony tony deleted the pytest-site-paths branch June 11, 2022 20:52
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.

1.7.0: running pytest only possible with poetry or using PYTHONPATH
2 participants