Fix broken test

This commit is contained in:
NateScarlet 2019-03-12 22:39:44 +08:00
parent 79d0177c41
commit 0bb4b18e1d
No known key found for this signature in database
GPG Key ID: 5C242793B070309C
2 changed files with 17 additions and 8 deletions

16
tests/conftest.py Normal file
View File

@ -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

View File

@ -1,17 +1,10 @@
"""Test module `fetch_holidays`. """ """Test module `fetch_holidays`. """
import json import json
import os
import sys import sys
from conftest import _file_path
from fetch_holidays import CustomJSONEncoder, DescriptionParser 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): def _normalize(iterable):
return sorted(json.loads(json.dumps(list(iterable), cls=CustomJSONEncoder)), return sorted(json.loads(json.dumps(list(iterable), cls=CustomJSONEncoder)),