I would like to write unit tests to test whether a dependency exists between two python packages. E.g.:
a/
__init__.py
models.py
views.py
...
b/
__init__.py
models.py
views.py
...
a unit test to check that modules in package b
don't import anything from modules in package a
. The only solution I have so far is to scan the files and check that there isn't a "from a" or "import a" in the source code. Are there other ways of doing this? One of the requirements is that a/
and b/
must be in the same directory level.
I would like to have this unit test because I want to be sure that I can use package b
in other projects without package a
, and also not have other developers write code that will make b
dependent on a
.