Files
django-stubs/scripts/build_import_all_test.py
Maxim Kurnikov aeb435c8b3 Disable monkeypatches, add dependencies via new hook (#60)
* code cleanups, disable monkeypatches, move to add_additional_deps

* disable incremental mode for tests

* add pip-wheel-metadata

* move some code from get_base_hook to get_attribute_hook to reduce dependencies

* simplify values/values_list tests and code

* disable cache for some tests failing with incremental mode

* enable incremental mode for tests typechecking

* pin mypy version

* fix tests

* lint

* fix internal crashes
2019-04-12 14:54:00 +03:00

29 lines
782 B
Python

import os
from pathlib import Path
from typing import List
STUBS_ROOT = Path(__file__).parent.parent / 'django-stubs'
def build_package_name(path: str) -> str:
return '.'.join(['django'] + list(Path(path).relative_to(STUBS_ROOT).with_suffix('').parts))
packages: List[str] = []
for dirpath, dirnames, filenames in os.walk(STUBS_ROOT):
if not dirnames:
package = build_package_name(dirpath)
packages.append(package)
for filename in filenames:
if filename != '__init__.pyi':
package = build_package_name(os.path.join(dirpath, filename))
packages.append(package)
test_lines: List[str] = []
for package in packages:
test_lines.append('import ' + package)
test_contents = '\n'.join(test_lines)
print(test_contents)