tests: thinking about external repositories
This commit is contained in:
parent
41c5b34006
commit
44aa062756
2 changed files with 30 additions and 2 deletions
|
@ -11,6 +11,7 @@ def test_dynamic_config_1(tmp_path: Path) -> None:
|
|||
class user_config:
|
||||
username = 'user'
|
||||
data_path = f'{tmp_path}/*.json'
|
||||
external = f'{tmp_path}/external'
|
||||
my.config.demo = user_config # type: ignore[misc, assignment]
|
||||
|
||||
from my.demo import items
|
||||
|
@ -29,6 +30,7 @@ def test_dynamic_config_2(tmp_path: Path) -> None:
|
|||
class user_config:
|
||||
username = 'user2'
|
||||
data_path = f'{tmp_path}/*.json'
|
||||
external = f'{tmp_path}/external'
|
||||
my.config.demo = user_config # type: ignore[misc, assignment]
|
||||
|
||||
from my.demo import items
|
||||
|
@ -75,6 +77,7 @@ def test_attribute_handling(tmp_path: Path) -> None:
|
|||
|
||||
username = 'UUU'
|
||||
data_path = f'{tmp_path}/*.json'
|
||||
external = f'{tmp_path}/external'
|
||||
|
||||
|
||||
my.config.demo = user_config # type: ignore[misc, assignment]
|
||||
|
@ -99,4 +102,10 @@ def prepare(tmp_path: Path):
|
|||
{"key2": 2}
|
||||
]
|
||||
''')
|
||||
ext = tmp_path / 'external'
|
||||
ext.mkdir()
|
||||
(ext / '__init__.py').write_text('identity = lambda x: x')
|
||||
yield
|
||||
ex = 'my.config.repos.external'
|
||||
if ex in sys.modules:
|
||||
del sys.modules[ex]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue