From fb9ea484322af4a5e041ed037b690416d94bc7e7 Mon Sep 17 00:00:00 2001 From: Brett Date: Wed, 13 Dec 2023 16:24:15 -0500 Subject: [PATCH] turn warnings into errors on pyargs runs --- asdf/conftest.py | 8 ++++++++ pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/asdf/conftest.py b/asdf/conftest.py index ae1411407..20daaec42 100644 --- a/asdf/conftest.py +++ b/asdf/conftest.py @@ -8,6 +8,14 @@ collect_ignore = ["asdf.py", "stream.py"] +def pytest_collection_modifyitems(items): + # Turn warnings into errors for all tests, this is needed + # as running tests through pyargs will not use settings + # defined in pyproject.toml + for item in items: + item.add_marker(pytest.mark.filterwarnings("error"), False) + + @pytest.fixture(scope="session", autouse=True) def _temp_cwd(tmpdir_factory): """ diff --git a/pyproject.toml b/pyproject.toml index 34c35c298..b4dee14df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,7 +105,7 @@ norecursedirs = ['build', 'docs/_build', 'docs/sphinxext'] doctest_plus = 'enabled' remote_data_strict = true filterwarnings = [ - 'error', + 'error', # also set in _tests/conftest to work with pyargs 'ignore:numpy.ndarray size changed:RuntimeWarning', ] # Configuration for pytest-doctestplus