Skip to content

Commit d185fae

Browse files
Quick script to test for import loops
Since `test-docs.sh` was intermittently finding an import loop while I was writing the previous commit, but only by chance, when it happened to run the documentation in some particular order.
1 parent 65a887e commit d185fae

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

design/test_import_loops.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
3+
import subprocess
4+
import sys
5+
from pathlib import Path
6+
7+
def main():
8+
my_path = Path(sys.argv[0])
9+
design_dir = my_path.parent
10+
project_dir = design_dir.parent
11+
skyfield_dir = project_dir / 'skyfield'
12+
13+
for path in sorted(skyfield_dir.glob('*.py')):
14+
module_name = path.stem
15+
command = ['python3', '-c', 'import skyfield.' + module_name]
16+
print(module_name)
17+
try:
18+
subprocess.check_call(command)
19+
except subprocess.CalledProcessError:
20+
exit(1)
21+
22+
if __name__ == '__main__':
23+
main()

0 commit comments

Comments
 (0)