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

Defer plugin imports #3159

Merged
merged 3 commits into from Nov 28, 2021
Merged

Conversation

Zac-HD
Copy link
Member

@Zac-HD Zac-HD commented Nov 22, 2021

Fixes #3140, by ensuring that running our pytest plugin doesn't lead to Hypothesis being imported (and consequently running all our entry points) unless Hypothesis is already in use, a Hypothesis-specific argument is passed on the command line or config file, etc.

I think in practice this also fixes #3154, but @rsokl might correct me.

@Zac-HD Zac-HD added bug something is clearly wrong here interop how to play nicely with other packages labels Nov 22, 2021
@Zac-HD Zac-HD force-pushed the defer-plugin-imports branch 2 times, most recently from 7428c52 to 57e3606 Compare November 22, 2021 07:19
@rsokl
Copy link
Contributor

rsokl commented Nov 22, 2021

I can confirm that this does, in practice, fix #3154. On master, merely having pydantic + hypothesis installed will guarantee that NumPy is imported whenever pytest is run. With this branch checked out, that is no longer the behavior.

@Zac-HD Zac-HD force-pushed the defer-plugin-imports branch 3 times, most recently from a087245 to 4f189cb Compare November 23, 2021 04:26
@Zalathar
Copy link
Contributor

(I appreciate that the stub plugin is in its own revision, as having separate rename and replace revisions tends to make Git archaeology a bit nicer than if they were squashed into one. 👨‍🍳👍)

This isn't perfect, but it seems like a big improvement over the status quo.

Closes HypothesisWorks#3018.

Co-Authored-By: Stuart Cook <Zalathar@users.noreply.github.com>
@Zac-HD Zac-HD merged commit eca4cff into HypothesisWorks:master Nov 28, 2021
@Zac-HD Zac-HD deleted the defer-plugin-imports branch November 28, 2021 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is clearly wrong here interop how to play nicely with other packages
Projects
None yet
3 participants