diff --git a/CHANGELOG.md b/CHANGELOG.md index 108b0e2..4258d9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * Detect when a file has expired and raise a ``UserWarning`` * Add Travis CI badge on README. * Warn user when there's a download error. Expiration date file won't be modified if at least one of the downloads has failed. +* Added a test to check if the current files are about to expire (45 days from now). Travis CI would run a monthly job and eventually report when it has failed, so actions can be done to refresh the files and "unbreak" the library. ## 0.0.2 (2019-08-23) diff --git a/tests/test_expiration_date.py b/tests/test_expiration_date.py index 4646da3..98ecebe 100644 --- a/tests/test_expiration_date.py +++ b/tests/test_expiration_date.py @@ -1,7 +1,7 @@ import mock -from datetime import date -from datetime import timedelta +from datetime import date, timedelta from skyfield_data import get_skyfield_data_path +from skyfield_data.expiration_data import EXPIRATIONS @mock.patch('skyfield_data.expirations.get_all') @@ -30,3 +30,13 @@ def test_expiration_deltat_yesterday(mocked_exp): with mock.patch('warnings.warn') as mocked_warn: get_skyfield_data_path() assert mocked_warn.call_count == 1 + + +def test_current_expiration_date(): + # Filter all files that would expire in 45 days + expired = { + k: v for k, v in EXPIRATIONS.items() + if date.today() >= v - timedelta(days=45) + } + assert not expired, \ + "{} files(s) are about to expire: {}".format(len(expired), expired)