Skip to content

Commit 0d53067

Browse files
authored
Merge pull request #3215 from bsipocz/MAINT_remove_testrunner
MAINT: remove the usage of TestRunner therefore remove astroquery.test()
2 parents 8e62857 + 518e5ea commit 0d53067

File tree

5 files changed

+35
-92
lines changed

5 files changed

+35
-92
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ xmatch
6767
Infrastructure, Utility and Other Changes and Additions
6868
-------------------------------------------------------
6969

70+
- Removed usage of the astropy TestRunner, therefore the unadvertised
71+
``astroquery.test()`` functionality. [#3215]
72+
7073

7174
0.4.9 (2025-01-24)
7275
==================

astroquery/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Affiliated packages may add whatever they like to this file, but
1010
# should keep this content at the top.
1111
# ----------------------------------------------------------------------------
12-
from ._astropy_init import __version__, __githash__, test
12+
from ._astropy_init import __version__, __githash__
1313
# ----------------------------------------------------------------------------
1414

1515
import os
@@ -18,7 +18,7 @@
1818
from .logger import _init_log
1919
from astropy import config as _config
2020

21-
__all__ = ["__version__", "__githash__", "__citation__", "__bibtex__", "test", "log"]
21+
__all__ = ["__version__", "__githash__", "__citation__", "__bibtex__", "log"]
2222

2323

2424
# Set the bibtex entry to the article referenced in CITATION.

astroquery/_astropy_init.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,3 @@
2121
from .version import githash as __githash__
2222
except ImportError:
2323
__githash__ = ''
24-
25-
26-
if not _ASTROPY_SETUP_: # noqa
27-
import os
28-
29-
# Create the test function for self test
30-
from astropy.tests.runner import TestRunner
31-
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))
32-
test.__test__ = False
33-
__all__ += ['test']

astroquery/conftest.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

conftest.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
22

3-
import numpy as np
4-
from astropy.utils import minversion
3+
import os
4+
from pathlib import Path
55

6+
from astropy.utils import minversion
7+
import numpy as np
8+
import pytest
69
from pytest_astropy_header.display import (PYTEST_HEADER_MODULES,
710
TESTED_VERSIONS)
811

@@ -22,6 +25,10 @@ def pytest_configure(config):
2225
PYTEST_HEADER_MODULES['astropy-healpix'] = 'astropy_healpix'
2326
PYTEST_HEADER_MODULES['vamdclib'] = 'vamdclib'
2427

28+
del PYTEST_HEADER_MODULES['h5py']
29+
del PYTEST_HEADER_MODULES['Scipy']
30+
del PYTEST_HEADER_MODULES['Pandas']
31+
2532
# keyring doesn't provide __version__ any more
2633
# PYTEST_HEADER_MODULES['keyring'] = 'keyring'
2734

@@ -32,3 +39,24 @@ def pytest_configure(config):
3239

3340
TESTED_VERSIONS['astroquery'] = version.version
3441
TESTED_VERSIONS['astropy_helpers'] = version.astropy_helpers_version
42+
43+
44+
def pytest_addoption(parser):
45+
parser.addoption(
46+
'--alma-site',
47+
action='store',
48+
default='almascience.eso.org',
49+
help='ALMA site (almascience.nrao.edu, almascience.eso.org or '
50+
'almascience.nao.ac.jp for example)'
51+
)
52+
53+
54+
@pytest.fixture(scope='function')
55+
def tmp_cwd(tmp_path):
56+
"""Perform test in a pristine temporary working directory."""
57+
old_dir = Path.cwd()
58+
os.chdir(tmp_path)
59+
try:
60+
yield tmp_path
61+
finally:
62+
os.chdir(old_dir)

0 commit comments

Comments
 (0)