Added cascade settings loading from ~/.maigret/settings.json and ./settings.json

This commit is contained in:
Soxoj
2021-11-05 13:40:21 +03:00
parent 4f5222df1c
commit f81a500d72
8 changed files with 79 additions and 38 deletions
+5 -1
View File
@@ -7,10 +7,12 @@ from _pytest.mark import Mark
from maigret.sites import MaigretDatabase
from maigret.maigret import setup_arguments_parser
from maigret.settings import Settings
CUR_PATH = os.path.dirname(os.path.realpath(__file__))
JSON_FILE = os.path.join(CUR_PATH, '../maigret/resources/data.json')
SETTINGS_FILE = os.path.join(CUR_PATH, '../maigret/resources/settings.json')
TEST_JSON_FILE = os.path.join(CUR_PATH, 'db.json')
LOCAL_TEST_JSON_FILE = os.path.join(CUR_PATH, 'local.json')
empty_mark = Mark('', (), {})
@@ -59,7 +61,9 @@ def reports_autoclean():
@pytest.fixture(scope='session')
def argparser():
return setup_arguments_parser()
settings = Settings()
settings.load([SETTINGS_FILE])
return setup_arguments_parser(settings)
@pytest.fixture(scope="session")
-1
View File
@@ -1,6 +1,5 @@
"""Maigret Database test functions"""
from maigret.sites import MaigretDatabase, MaigretSite
from maigret.utils import URLMatcher
EXAMPLE_DB = {
'engines': {