Skip to content

Commit 1ff3b7f

Browse files
authored
Merge pull request #2502 from eerovaher/remote-test-modules
Recommend a better way to mark remote data tests in remote test modules
2 parents 8bfeac0 + 361b242 commit 1ff3b7f

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

astroquery/atomic/tests/test_atomic_remote.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
from ...atomic import AtomicLineList
88

9+
pytestmark = pytest.mark.remote_data
10+
911

10-
@pytest.mark.remote_data
1112
def test_default_form_values():
1213
default_response = AtomicLineList._request(
1314
method="GET", url=AtomicLineList.FORM_URL,
@@ -28,7 +29,6 @@ def test_default_form_values():
2829
'wave': u'Angstrom'}
2930

3031

31-
@pytest.mark.remote_data
3232
def test_query_with_default_params():
3333
table = AtomicLineList.query_object(cache=False)
3434
assert isinstance(table, Table)
@@ -43,7 +43,6 @@ def test_query_with_default_params():
4343
1.02916 Zn XXX E1 1*-6* 1-6 1/2-* 1.33E+12 0.00 - 97174700.00'''.strip()
4444

4545

46-
@pytest.mark.remote_data
4746
def test_query_with_wavelength_params():
4847
result = AtomicLineList.query_object(
4948
wavelength_range=(15 * u.nm, 200 * u.Angstrom),
@@ -66,15 +65,13 @@ def test_query_with_wavelength_params():
6665
'0.00 - 502481.80']))
6766

6867

69-
@pytest.mark.remote_data
7068
def test_empty_result_set():
7169
result = AtomicLineList.query_object(wavelength_accuracy=0, cache=False)
7270
assert isinstance(result, Table)
7371
assert not result
7472
assert len(result) == 0
7573

7674

77-
@pytest.mark.remote_data
7875
def test_lower_upper_ranges():
7976
result = AtomicLineList.query_object(
8077
lower_level_energy_range=u.Quantity((600 * u.cm**(-1), 1000 * u.cm**(-1))),

docs/testing.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,14 @@ the ``test_module.py`` file.
8484
``test_module_remote.py``
8585
-------------------------
8686

87-
The remote tests are much easier. Just decorate the test class or test
88-
functions with ``@pytest.mark.remote_data``.
87+
The remote tests are much easier. The file must contain the following::
88+
89+
import pytest
90+
91+
pytestmark = pytest.mark.remote_data
92+
93+
This ensures that the test functions in remote test module are only executed if
94+
the ``--remote-data`` flag is used.
8995

9096
``setup_package.py``
9197
--------------------

0 commit comments

Comments
 (0)