Skip to content

Commit 5400c5a

Browse files
committed
Test case for circular imports
1 parent a704e05 commit 5400c5a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_cicular_imports.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import pkgutil
2+
import subprocess
3+
import sys
4+
5+
import sphinx_needs
6+
7+
8+
def test_no_circular_imports():
9+
"""
10+
Test for circular imports in the sphinx_needs package.
11+
12+
Each package is tested isolated by importing it into a
13+
new Python interpreter.
14+
"""
15+
for _, name, _ in pkgutil.walk_packages(
16+
sphinx_needs.__path__, prefix="sphinx_needs."
17+
):
18+
subprocess.check_call(
19+
[
20+
sys.executable,
21+
"-c",
22+
"import importlib; importlib.import_module(" + repr(name) + ")",
23+
]
24+
)

0 commit comments

Comments
 (0)