Replies: 2 comments
-
Mypy check of just the codebase should error in a venv thats missing test deps |
Beta Was this translation helpful? Give feedback.
0 replies
-
One alternative is to configure a https://github.com/seddonym/import-linter as a pre-commit hook. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
(disclaimer: this is not a pure pytest related question, but this felt like a good place to raise anyway)
Say you have a project which defines test dependencies. These test dependencies should only be used in the test code, but how do you ensure that they are not leaking accidentally in the main, non-test code (e.g. uncareful committing
import
statements that were added by some autocomplete feature of your IDE)?You can not catch this problem (e.g. looking for ImportErrors) with a normal pytest run, because the dependencies will be available in the test environment. Inversely, you can not run your tests in an environment without the test dependencies either.
Are there any approaches, tools, pytest plugins or trick to automatically check for leaking test (or more generally development) dependencies in your main code?
Any pointers to address this would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions