From c5b48d7a8b5c896055c7a36959a141d52b4c53f8 Mon Sep 17 00:00:00 2001 From: Wilfred Tyler Gee Date: Thu, 1 Jun 2023 13:44:41 -1000 Subject: [PATCH 1/8] Remove deprecated call to astropy helpers. Closes #553 --- astroplan/conftest.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/astroplan/conftest.py b/astroplan/conftest.py index 6c40ad56..aef191d6 100644 --- a/astroplan/conftest.py +++ b/astroplan/conftest.py @@ -15,8 +15,6 @@ PYTEST_HEADER_MODULES = {} TESTED_VERSIONS = {} -from astropy.tests.helper import enable_deprecations_as_exceptions - # We do this to pick up the test header report even when using LTS astropy try: from astropy.tests.pytest_plugins import pytest_report_header # noqa @@ -35,11 +33,6 @@ packagename = os.path.basename(os.path.dirname(__file__)) TESTED_VERSIONS[packagename] = version - -# Comment out this line to avoid deprecation warnings being raised as -# exceptions -enable_deprecations_as_exceptions() - # Define list of packages for which to display version numbers in the test log try: PYTEST_HEADER_MODULES['Astropy'] = 'astropy' From 9cc6f89d54c79476135959fffd96933bde060cea Mon Sep 17 00:00:00 2001 From: Wilfred Tyler Gee Date: Thu, 1 Jun 2023 13:55:34 -1000 Subject: [PATCH 2/8] Add the warnings-as-errors functionality via pytest options. --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3c71eec7..be322bac 100644 --- a/setup.cfg +++ b/setup.cfg @@ -48,6 +48,8 @@ doctest_plus = enabled text_file_format = rst addopts = --doctest-rst --doctest-ignore-import-errors norecursedirs = build docs/_build +filterwarnings = + error::DeprecationWarning [coverage:run] omit = @@ -89,4 +91,3 @@ max-line-length = 100 [pycodestyle] exclude = _astropy_init.py,extern,__init__.py max-line-length = 100 - From 82f4dcc32d1adb3d9c6ba928566cc8f9b1afc608 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:56:50 -1000 Subject: [PATCH 3/8] Update setup.cfg --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index be322bac..95629166 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,7 +49,7 @@ text_file_format = rst addopts = --doctest-rst --doctest-ignore-import-errors norecursedirs = build docs/_build filterwarnings = - error::DeprecationWarning + error [coverage:run] omit = From 1de5e3162cb5bd98d8f24233fa890991a21f8dac Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:58:00 -1000 Subject: [PATCH 4/8] Remove diff --- astroplan/conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/astroplan/conftest.py b/astroplan/conftest.py index aef191d6..cfaf7aad 100644 --- a/astroplan/conftest.py +++ b/astroplan/conftest.py @@ -33,6 +33,7 @@ packagename = os.path.basename(os.path.dirname(__file__)) TESTED_VERSIONS[packagename] = version + # Define list of packages for which to display version numbers in the test log try: PYTEST_HEADER_MODULES['Astropy'] = 'astropy' From cf2925f71e80efc2bb4199383b35d8101f069116 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:02:01 -1000 Subject: [PATCH 5/8] Update setup.cfg --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index 2fec85ff..d8594b09 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,6 +49,8 @@ addopts = --doctest-rst --doctest-ignore-import-errors norecursedirs = build docs/_build filterwarnings = error + ignore:numpy\.ndarray size changed:RuntimeWarning + ignore:numpy\.ufunc size changed:RuntimeWarning [coverage:run] omit = From d977740ff6e983f1453d3e9a4555b3072398f8e8 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:06:57 -1000 Subject: [PATCH 6/8] Update setup.cfg --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index d8594b09..5d9c074c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,6 +51,7 @@ filterwarnings = error ignore:numpy\.ndarray size changed:RuntimeWarning ignore:numpy\.ufunc size changed:RuntimeWarning + ignore:distutils Version classes are deprecated:DeprecationWarning [coverage:run] omit = From 9a752a6c4d8cb0ad504696bca8dd6f61c88bc3d3 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:13:17 -1000 Subject: [PATCH 7/8] Update setup.cfg --- setup.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.cfg b/setup.cfg index 5d9c074c..3cfdd4b2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,7 +51,10 @@ filterwarnings = error ignore:numpy\.ndarray size changed:RuntimeWarning ignore:numpy\.ufunc size changed:RuntimeWarning + # Can remove ignore when you bump astropy minversion high enough ignore:distutils Version classes are deprecated:DeprecationWarning + # deprecated in Matplotlib 3.9 and will be removed in 3.11. Use plot instead. + ignore:The plot_date function was deprecated [coverage:run] omit = From 3886859d192a99665fb3d957f07f020f881d20ff Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:24:07 -1000 Subject: [PATCH 8/8] Update test_constraints.py --- astroplan/tests/test_constraints.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/astroplan/tests/test_constraints.py b/astroplan/tests/test_constraints.py index 0084c159..5343c6fa 100644 --- a/astroplan/tests/test_constraints.py +++ b/astroplan/tests/test_constraints.py @@ -174,6 +174,8 @@ def test_galactic_plane_separation(): # in astropy before v1.0.4, a recursion error is triggered by this test @pytest.mark.skipif('APY_LT104') +# astropy.coordinates.errors.NonRotationTransformationWarning +@pytest.mark.filterwarnings("ignore") def test_sun_separation(): time = Time('2003-04-05 06:07:08') apo = Observer.at_site("APO") @@ -198,6 +200,8 @@ def test_sun_separation(): assert np.all(is_constraint_met == [False, True, True]) +# astropy.coordinates.errors.NonRotationTransformationWarning +@pytest.mark.filterwarnings("ignore") def test_moon_separation(): time = Time('2003-04-05 06:07:08') apo = Observer.at_site("APO") @@ -423,6 +427,8 @@ def test_rescale_minmax(): @pytest.mark.parametrize('constraint', constraint_tests) +# astropy.coordinates.errors.NonRotationTransformationWarning +@pytest.mark.filterwarnings("ignore") def test_regression_shapes(constraint): times = Time(["2015-08-28 03:30", "2015-09-05 10:30", "2015-09-15 18:35"]) targets = get_skycoord([FixedTarget(SkyCoord(350.7*u.deg, 18.4*u.deg)),