diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..be841b0 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,16 @@ +"""pytest config""" + +import os +import sys + +__dirname__ = os.path.abspath(os.path.dirname(__file__)) + + +def _file_path(*other): + + return os.path.abspath(os.path.join(__dirname__, *other)) + + +def pytest_configure(config): + sys.path.insert(0, _file_path('..')) + return config diff --git a/tests/test_fetch_holidays.py b/tests/test_fetch_holidays.py index 9c1f105..09e00bf 100644 --- a/tests/test_fetch_holidays.py +++ b/tests/test_fetch_holidays.py @@ -1,17 +1,10 @@ """Test module `fetch_holidays`. """ import json -import os import sys +from conftest import _file_path from fetch_holidays import CustomJSONEncoder, DescriptionParser -__dirname__ = os.path.abspath(os.path.dirname(__file__)) - - -def _file_path(*other): - - return os.path.join(__dirname__, *other) - def _normalize(iterable): return sorted(json.loads(json.dumps(list(iterable), cls=CustomJSONEncoder)),