You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot use Astroquery as a source with pytest-cov #3617
This may be more of an upstream issue, but I can't use pytest-cov with an internal test suite we have running at MAST. Using coverage directly works, but I want to use pytest-xdist, which requires pytest-cov and doesn't work correctly with coverage.
I run the above test file with this command: pytest --cov=astroquery.mast tests/test_minimal.py
The versions I have in my environment are:
Python = 3.12
pytest = 9.1.0
pytest-cov = 7.1.0
coverage = 7.14.1
astroquery = 0.4.11 (or installed from GH)
astropy = 7.2.0
numpy = 1.26.4
The traceback I get is:
tests/test_minimal.py:1: in <module>
from astroquery.mast import Observations
/opt/miniconda3/envs/amt/lib/python3.12/site-packages/astroquery/__init__.py:18: in <module>
from .logger import _init_log
/opt/miniconda3/envs/amt/lib/python3.12/site-packages/astroquery/logger.py:3: in <module>
from astropy.logger import AstropyLogger
/opt/miniconda3/envs/amt/lib/python3.12/site-packages/astropy/__init__.py:197: in <module>
log = _init_log()
^^^^^^^^^^^
/opt/miniconda3/envs/amt/lib/python3.12/site-packages/astropy/logger.py:122: in _init_log
log._set_defaults()
/opt/miniconda3/envs/amt/lib/python3.12/site-packages/astropy/logger.py:498: in _set_defaults
self.disable_warnings_logging()
/opt/miniconda3/envs/amt/lib/python3.12/site-packages/astropy/logger.py:278: in disable_warnings_logging
raise LoggingError(
E astropy.logger.LoggingError: Cannot disable warnings logging: warnings.showwarning was not set by this logger, or has been overridden
this seems to be an issue with the astropy logger, so I would recommend moving the issue upstream
I can run tox -e test-online-cov -- -P mast without any issues, so having issues with custom environments and pytest plugins that are not used in astroquery feels to be out of scope
Activity
bsipocz commentedon Jun 18, 2026
Two comments:
tox -e test-online-cov -- -P mastwithout any issues, so having issues with custom environments and pytest plugins that are not used in astroquery feels to be out of scope