diff --git a/.travis.yml b/.travis.yml index 7a9ad20..84cd78a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,9 +16,10 @@ before_script: - git checkout master - ./cc-test-reporter before-build script: - - pytest + - coverage run -m pytest - coverage run -a ./update.py --release after_script: + - coverage xml && coverage report - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT branches: only: diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 1d82b8c..0000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -addopts = --cov=. diff --git a/requirements.txt b/requirements.txt index 57651a5..5584605 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ requests ~= 2.21.0 beautifulsoup4 ~= 4.7.1 tqdm ~= 4.30.0 pytest ~= 4.3.0 -pytest-cov ~= 2.6.1 +coverage ~= 4.5.3 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/tests/filetools.py similarity index 56% rename from tests/conftest.py rename to tests/filetools.py index be841b0..31de6d6 100644 --- a/tests/conftest.py +++ b/tests/filetools.py @@ -1,16 +1,9 @@ -"""pytest config""" +"""Tools for files. """ 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 09e00bf..fd6cb47 100644 --- a/tests/test_fetch_holidays.py +++ b/tests/test_fetch_holidays.py @@ -2,9 +2,10 @@ import json import sys -from conftest import _file_path from fetch_holidays import CustomJSONEncoder, DescriptionParser +from .filetools import _file_path + def _normalize(iterable): return sorted(json.loads(json.dumps(list(iterable), cls=CustomJSONEncoder)),