general: move reddit tests into my/tests + tweak my.core.cfg to be more reliable
This commit is contained in:
parent
fcfc423a75
commit
7cfbd30ee0
21 changed files with 77 additions and 54 deletions
29
my/tests/common.py
Normal file
29
my/tests/common.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
V = 'HPI_TESTS_KARLICOSS'
|
||||
|
||||
skip_if_not_karlicoss = pytest.mark.skipif(
|
||||
V not in os.environ,
|
||||
reason=f'test only works on @karlicoss data for now. Set evn variable {V}=true to override.',
|
||||
)
|
||||
|
||||
|
||||
def reset_modules() -> None:
|
||||
'''
|
||||
A hack to 'unload' HPI modules, otherwise some modules might cache the config
|
||||
TODO: a bit crap, need a better way..
|
||||
'''
|
||||
to_unload = [m for m in sys.modules if re.match(r'my[.]?', m)]
|
||||
for m in to_unload:
|
||||
del sys.modules[m]
|
||||
|
||||
|
||||
def testdata() -> Path:
|
||||
d = Path(__file__).absolute().parent.parent.parent / 'testdata'
|
||||
assert d.exists(), d
|
||||
return d
|
Loading…
Add table
Add a link
Reference in a new issue