Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.1rc2] TestDefaultAutoOpen.test_system_file_used_if_not_expired failure #10742

Open
olebole opened this issue Sep 17, 2020 · 4 comments
Open
Labels

Comments

@olebole
Copy link
Member

olebole commented Sep 17, 2020

Description

When running the tests on an installed Debian package for version 4.1rc2, test_system_file_used_if_not_expired fails. The failure did not appear during the build time test of the package.

I don't understand what exactly was tested here and so it may be that I should just patch this.

Expected behavior

The test succeeds.

Actual behavior

Copied from the test log:

platform linux -- Python 3.8.6rc1, pytest-4.6.11, py-1.9.0, pluggy-0.13.0
rootdir: /tmp/autopkgtest-lxc.qsna6ryk/downtmp/autopkgtest_tmp
plugins: openfiles-0.5.0, remotedata-0.3.2, hypothesis-5.32.1, astropy-header-0.1.2, filter-subpackage-0.1.1, arraydiff-0.3, cov-2.8.1, doctestplus-0.7.0
…
___________ TestDefaultAutoOpen.test_system_file_used_if_not_expired ___________

self = <astropy.utils.iers.tests.test_leap_second.TestDefaultAutoOpen object at 0x7fed36f711c0>
tmpdir = local('/tmp/pytest-of-debci/pytest-0/test_system_file_used_if_not_e0')

    @pytest.mark.skipif(not os.path.isfile(SYSTEM_FILE),
                        reason=f'system does not have {SYSTEM_FILE}')
    def test_system_file_used_if_not_expired(self, tmpdir):
        # We skip the test if the system file is on a CI and is expired -
        # we should not depend on CI keeping it up to date, but if it is,
        # we should check that it is used if possible.
        if (iers.LeapSeconds.open(SYSTEM_FILE).expires <= self.good_enough):
            pytest.skip("System leap second file is expired.")
    
        self.remove_auto_open_files('erfa')
        with iers.conf.set_temp('system_leap_second_file', SYSTEM_FILE):
            ls = iers.LeapSeconds.open()
            assert ls.expires > self.good_enough
            assert ls.meta['data_url'] in (iers.IERS_LEAP_SECOND_FILE,
                                           SYSTEM_FILE)
    
            # Also check with a "built-in" file that is expired
            fake_file = make_fake_file('28 June 2017', tmpdir)
            iers.LeapSeconds._auto_open_files[0] = fake_file
            ls2 = iers.LeapSeconds.open()
            assert ls2.expires > Time.now()
>           assert ls2.meta['data_url'] == SYSTEM_FILE
E           AssertionError: assert 'https://hpie...ap_Second.dat' == '/usr/share/zo...-seconds.list'
E             - https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat
E             + /usr/share/zoneinfo/leap-seconds.list

/usr/lib/python3/dist-packages/astropy/utils/iers/tests/test_leap_second.py:264: AssertionError

Steps to Reproduce

  1. Take the python3-astropy package 4.2rc1 from Debian experimental (should pop up there soon)
  2. install it on a Debian "testing" or "unstable" distribution
  3. run python3 -m pytest --pyargs astropy

System Details

Linux-5.7.0-3-amd64-x86_64-with-glibc2.29
Python 3.8.6rc1
Numpy 1.19.2
astropy 4.1rc2
Scipy 1.5.2
Matplotlib 3.3.0

@pllim pllim added the testing label Sep 17, 2020
@pllim pllim added this to the v4.1 milestone Sep 17, 2020
@pllim

This comment has been minimized.

@pllim
Copy link
Member

pllim commented Sep 17, 2020

@mhvk , it appears the file used here is not the system file the test is expecting. I don't think this was addressed in #9720 . Any ideas?

@mhvk
Copy link
Contributor

mhvk commented Sep 17, 2020

@olebole - the test fails if the computer that it is run on has an out-of-date leap-second file, and this is recognized by the fact that in that case the code doesn't use it. So, the file on your machine is likely out of date.

That said, I think this test has only ever given us headaches, well more than is worth it, and I think I should stop hoping that it could be useful in some way!

@eteq
Copy link
Member

eteq commented Oct 16, 2020

Re-milestoning to 4.1.1 since it's not really a "live" failure (we think... - see @mhvk's comment jsust-above)

@eteq eteq modified the milestones: v4.1, v4.1.1 Oct 16, 2020
@bsipocz bsipocz modified the milestones: v4.1.1, v4.2.1 Nov 25, 2020
@pllim pllim modified the milestones: v4.2.1, v4.2.2 Apr 8, 2021
@eteq eteq modified the milestones: v4.2.2, v4.3.2 Jul 27, 2021
@bsipocz bsipocz removed this from the v4.3.2 milestone Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants