Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

Commit 2f58cbe

Browse files
committed
Catch broad class of exceptions when attempting to import from astropy.tests--I found at least one case where, on older versions of Astropy, that 'import astropy.tests' results in loading the bundled pytest which fails for some reason.
1 parent cd0f1b2 commit 2f58cbe

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎astropy_helpers/commands/test.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@
1212
learn that they need Astropy to run it.
1313
"""
1414

15+
16+
# Previously these except statements caught only ImportErrors, but there are
17+
# some other obscure exceptional conditions that can occur when importing
18+
# astropy.tests (at least on older versions) that can cause these imports to
19+
# fail
1520
try:
1621
import astropy
1722
try:
1823
from astropy.tests.command import AstropyTest
19-
except ImportError:
24+
except Exception:
2025
from ._test_compat import AstropyTest
21-
except ImportError:
26+
except Exception:
2227
# No astropy at all--provide the dummy implementation
2328
import sys
2429
from setuptools import Command

0 commit comments

Comments
 (0)