-
Notifications
You must be signed in to change notification settings - Fork 20
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
Deptry should detect missing dependencies in tests/ #302
Comments
The part regarding possibly, other folders as well is explained in a bit more detail in #300. |
This would be a nice feature, but it does require us to rethink and redesign the way deptry handles development dependencies. Right now, all development dependencies are placed together in one list, see here. However, if we want to support the functionality mentioned here, we would need to ;
For point (1) this is already a bit complicated, since
So with the lack of standardization, I am a bit hesitant to incorporate this. Maybe I am over-complicating this or overlooking something. Please let me know if you have any feedback or thoughts on the above! |
I understand your hesitation here. However, I think much can be gained by using a less complex approach. If This approach would cover a huge use case of simple projects with only prod- and dev-dependencies. It would allow to cover the use case in #300. It would not cover the advanced use cases you presented, but these are not supported as of now neither. So, in a nutshell: Some additional use cases would be supported without, presumably, too much effort. However, I would totally understand if you would prefer not to implement something that does not cover all use cases. |
I think your suggestion makes sense. If we were go with the approach you mention, I think we should add a fifth check (next to the four existing checks that deptry scans for; missing development dependency. In addition to adding the check, we would also need to enable the user to configure directories that use development dependencies, such as Then the remaining question is; is the check 'missing development dependency' worth the (small) additional complexity in the code and configuration? Wouldn't |
P.S. Sorry for my slow responses! |
You are totally right, missing dependencies used in unit tests should be noticed when running the tests. However, if However, the most value of a tests check would come from supporting #300. After having very fine-granular dependencies for some time, I am back to lumping everything into |
That makes sense! I personally have no time to work on this at the moment, might pick it up in the future if it remains open. In the meantime, if anyone feels like this is something they want to implement I'd be happy to assist or review PR's. |
One idea, now that PEP 735 is a thing, is to have a special case to handle the One approach would just be to disable checking the |
As of now,
deptry
simply ignores eveything undertests/
. This means that imports that are used but not present will be noticed only at execution time, not before.For instance, suppose I have a
tests/test_sending_request.py
with the following content:If
httpretty
is not included in the dev-dependencies, my test would crash withModuleNotFoundError
, even if I useddeptry
. Given thatdeptry
can detect exactly this kind of issue for normal dependencies, I would love to see that extended totests/
and, possibly, other folders as well.The text was updated successfully, but these errors were encountered: