ok, seems that import_dir is a bit saner

This commit is contained in:
Dima Gerasimov 2020-05-18 21:04:38 +01:00
parent 44aa062756
commit 0f80e9d5e6
3 changed files with 16 additions and 3 deletions

View file

@ -104,7 +104,14 @@ def prepare(tmp_path: Path):
''')
ext = tmp_path / 'external'
ext.mkdir()
(ext / '__init__.py').write_text('identity = lambda x: x')
(ext / '__init__.py').write_text('''
def identity(x):
from .submodule import hello
hello(x)
return x
''')
(ext / 'submodule.py').write_text('hello = lambda x: print("hello " + str(x))')
yield
ex = 'my.config.repos.external'
if ex in sys.modules: