Open dpinol opened 1 year ago
You should be able to fix this by adding pytest_check as one of the root packages. Alternatively, change pytest_check.check
to just pytest_check
.
The reason for this is because Import Linter analyses a graph of the imports between different modules. If you don't include pytest_check
as a root package then it will just be added as a single node pytest_check
in the graph.
Hope that solves your problem!
jumping in here, with (snippets from pyproject.toml):
[tool.importlinter]
root_packages = ["survey", "api", "django"]
include_external_packages = true
[[tool.importlinter.contracts]]
name = "Dont use cache dependencies directly"
type = "forbidden"
source_modules = ["survey", "api"]
forbidden_modules = ["django.core.cache"]
From the above comment, I would expect django.core.cache
to be forbidden, but, I get a huge list of import errors as any import under django.*
is listed as an error.
If I change root_packages to either
root_packages = ["survey", "api", "django.core"]
#
root_packages = ["survey", "api", "django.core.cache"]
then no linting errors related to the Django package are detected.
I'd like to, for example, prevent usage of anything under django.core.cache
by raising lint errors. is this possible some other way>
@pwalsh - I've opened a separate ticket for your question, see link above.
With this config I get:
Invalid forbidden module pytest_check.check: subpackages of external packages are not valid.