diff --git a/setup.cfg b/setup.cfg index 05cf437..ac0e9e8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -57,7 +57,8 @@ tests_require = zipp==1.1.0; python_version >= "2.7" and python_version < "3.6" [tool:pytest] -addopts= --cov=git_archive_all --cov-report=term --cov-branch --showlocals -vv +addopts = --cov=git_archive_all --cov-report=term --cov-branch --showlocals -vv +filterwarnings = error [tox:tox] envlist = diff --git a/test_git_archive_all.py b/test_git_archive_all.py index b16413f..957ee24 100644 --- a/test_git_archive_all.py +++ b/test_git_archive_all.py @@ -10,6 +10,7 @@ from subprocess import check_call import sys from tarfile import TarFile, PAX_FORMAT +import warnings import pycodestyle import pytest @@ -384,8 +385,13 @@ def test_ignore(contents, exclude, tmpdir, git_env, monkeypatch): """ Ensure that GitArchiver respects export-ignore. """ - for name, value in git_env.items(): - monkeypatch.setenv(name, value) + + # On Python 2.7 contained code raises pytest.PytestWarning warning for no good reason. + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + + for name, value in git_env.items(): + monkeypatch.setenv(name, value) repo_path = os_path_join(tmpdir.strpath, 'repo') repo = Repo(repo_path)