From 0bb4b18e1d1576b738bdf1d631b70f14dbc86194 Mon Sep 17 00:00:00 2001 From: NateScarlet Date: Tue, 12 Mar 2019 22:39:44 +0800 Subject: [PATCH] Fix broken test --- tests/conftest.py | 16 ++++++++++++++++ tests/test_fetch_holidays.py | 9 +-------- 2 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 tests/conftest.py 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)),