Skip to content

Commit

Permalink
Remove deprecated call to astropy helpers. (#554)
Browse files Browse the repository at this point in the history
* Remove deprecated call to astropy helpers.

Closes #553

* Add the warnings-as-errors functionality via pytest options.

---------

Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
  • Loading branch information
wtgee and pllim authored Dec 4, 2024
1 parent b04135b commit bf5e26d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions astroplan/tests/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down Expand Up @@ -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)),
Expand Down
9 changes: 8 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ doctest_plus = enabled
text_file_format = rst
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
# 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 =
Expand Down Expand Up @@ -88,4 +96,3 @@ max-line-length = 100
[pycodestyle]
exclude = _astropy_init.py,extern,__init__.py
max-line-length = 100

0 comments on commit bf5e26d

Please sign in to comment.