From f7a6f9ed9b69d3dc1fb0586b89f16eff37951b22 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 12 Oct 2017 09:56:27 -0400 Subject: Enable DeprecationWarnings during tests --- igor.py | 14 -------------- tests/conftest.py | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 tests/conftest.py diff --git a/igor.py b/igor.py index 15e385e7..2e8bab3d 100644 --- a/igor.py +++ b/igor.py @@ -22,20 +22,6 @@ import zipfile import pytest -# We want to see all warnings while we are running tests. But we also need to -# disable warnings for some of the more complex setting up of tests. -warnings.simplefilter("default") - -# Silence specific warnings that are not our fault. -warnings.filterwarnings("ignore", module="xdist", message="type argument to addoption") -warnings.filterwarnings("ignore", module="flaky", message="type argument to addoption") -warnings.filterwarnings( - # https://github.com/pytest-dev/pytest/issues/2118 - "ignore", - module="_pytest", - message="This usage is deprecated, please use pytest.* instead" -) - @contextlib.contextmanager def ignore_warnings(): diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..a0c21a84 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,18 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +""" +Pytest auto configuration. + +This module is run automatically by pytest, to define and enable fixtures. +""" + +import pytest +import warnings + + +@pytest.fixture(autouse=True) +def set_warnings(): + """Enable DeprecationWarnings during all tests.""" + warnings.simplefilter("default") + warnings.simplefilter("once", DeprecationWarning) -- cgit v1.2.1