Even if IERS_Auto predictive values are stale, do not download IERS-A if downloading is disabled by ayshih · Pull Request #17387 · astropy/astropy · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions astropy/utils/iers/iers.py
16 changes: 13 additions & 3 deletions astropy/utils/iers/tests/test_iers.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,22 @@ def test_simple(self):
dat.ut1_utc(Time(60000, format="mjd").jd)
assert len(warns) == 1

# Warning only if we are getting return status
# Confirm that disabling the download means no warning because there is no
# refresh to even fail, but there will still be the interpolation error
with (
iers.conf.set_temp("auto_download", False),
pytest.raises(
ValueError,
match="interpolating from IERS_Auto using predictive values that are more",
),
):
dat.ut1_utc(Time(60000, format="mjd").jd)

# Warning only (i.e., no exception) if we are getting return status
with pytest.warns(
iers.IERSStaleWarning, match="IERS_Auto predictive values are older"
) as warns:
):
dat.ut1_utc(Time(60000, format="mjd").jd, return_status=True)
assert len(warns) == 1

# Now set auto_max_age = None which says that we don't care how old the
# available IERS-A file is. There should be no warnings or exceptions.
Expand Down
2 changes: 2 additions & 0 deletions docs/changes/utils/17387.bugfix.rst