add test for config.set_repo
This commit is contained in:
parent
4cceccd787
commit
fd224d8c38
1 changed files with 26 additions and 1 deletions
|
@ -55,4 +55,29 @@ Some misc stuff
|
|||
pass
|
||||
|
||||
|
||||
# TODO test set_repo?
|
||||
def test_set_repo(tmp_path: Path) -> None:
|
||||
from my.cfg import config
|
||||
from types import SimpleNamespace
|
||||
config.hypothesis = SimpleNamespace( # type: ignore[misc,assignment]
|
||||
export_path='whatever',
|
||||
)
|
||||
|
||||
# precondition:
|
||||
# should fail because can't find hypexport
|
||||
with pytest.raises(ModuleNotFoundError):
|
||||
import my.hypothesis
|
||||
|
||||
fake_hypexport = tmp_path / 'hypexport'
|
||||
fake_hypexport.mkdir()
|
||||
(fake_hypexport / 'dal.py').write_text('''
|
||||
Highlight = None
|
||||
Page = None
|
||||
DAL = None
|
||||
''')
|
||||
|
||||
from my.cfg import set_repo
|
||||
# FIXME meh. hot sure about setting the parent??
|
||||
set_repo('hypexport', tmp_path)
|
||||
|
||||
# should succeed now!
|
||||
import my.hypothesis
|
||||
|
|
Loading…
Add table
Reference in a new issue