Skip to content

Commit e3f24d6

Browse files
authored
Merge pull request #2633 from bsipocz/MAINT_fix_remotes_202212
MAINT: fixing some remote failures from 202212
2 parents bdff658 + 3288da0 commit e3f24d6

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

astroquery/cds/tests/test_mocserver_remote.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
# -*- coding: utf-8 -*
22

33
# Licensed under a 3-clause BSD style license - see LICENSE.rst
4-
import sys
54
import pytest
65

76
from astropy import coordinates
87
from astropy.table import Table
98

109
try:
1110
from mocpy import MOC
11+
HAS_MOCPY = True
1212
except ImportError:
13-
pass
13+
HAS_MOCPY = False
1414

1515
try:
1616
from regions import CircleSkyRegion
17+
HAS_REGIONS = True
1718
except ImportError:
18-
pass
19+
HAS_REGIONS = False
1920

2021
from ..core import cds
2122

2223

2324
@pytest.mark.remote_data
25+
@pytest.mark.skipif(not HAS_MOCPY, reason='mocpy is required')
2426
class TestMOCServerRemote:
2527
"""
2628
Tests requiring regions
2729
"""
2830

2931
# test of MAXREC payload
30-
@pytest.mark.skipif('regions' not in sys.modules,
31-
reason="requires astropy-regions")
32+
@pytest.mark.skipif(not HAS_REGIONS, reason='regions is required')
3233
@pytest.mark.parametrize('max_rec', [3, 10, 25, 100])
3334
def test_max_rec_param(self, max_rec):
3435
center = coordinates.SkyCoord(ra=10.8, dec=32.2, unit="deg")
@@ -42,8 +43,7 @@ def test_max_rec_param(self, max_rec):
4243
assert max_rec == len(result)
4344

4445
# test of field_l when retrieving dataset records
45-
@pytest.mark.skipif('regions' not in sys.modules,
46-
reason="requires astropy-regions")
46+
@pytest.mark.skipif(not HAS_REGIONS, reason='regions is required')
4747
@pytest.mark.parametrize('field_l', [['ID'],
4848
['ID', 'moc_sky_fraction'],
4949
['data_ucd', 'vizier_popularity', 'ID'],
@@ -65,8 +65,6 @@ def test_field_l_param(self, field_l):
6565
"""
6666

6767
# test of moc_order payload
68-
@pytest.mark.skipif('mocpy' not in sys.modules,
69-
reason="requires MOCPy")
7068
@pytest.mark.parametrize('moc_order', [5, 10])
7169
def test_moc_order_param(self, moc_order, tmp_cwd):
7270

astroquery/esa/xmm_newton/tests/test_xmm_newton_remote.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def test_get_epic_metadata(self):
190190
radius))
191191
assert report_diff_values(slew_source, table)
192192

193-
def test_download_proprietary_data_incorrect_credentials(self):
193+
def test_download_proprietary_data_incorrect_credentials(self, tmp_cwd):
194194
parameters = {'observation_id': "0762470101",
195195
'prop': 'True',
196196
'credentials_file': "astroquery/esa/xmm_newton/tests/data/dummy_config.ini",
@@ -204,7 +204,7 @@ def test_download_proprietary_data_incorrect_credentials(self):
204204
with pytest.raises(LoginError):
205205
xsa.download_data(**parameters)
206206

207-
def test_download_proprietary_data_without_credentials(self):
207+
def test_download_proprietary_data_without_credentials(self, tmp_cwd):
208208
parameters = {'observation_id': "0883780101",
209209
'level': "PPS",
210210
'name': 'OBSMLI',

astroquery/tests/test_cache.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import requests
22
import os
3+
import pytest
34

45
from time import mktime
56
from datetime import datetime
@@ -15,6 +16,10 @@
1516
TEXT1 = "Penguin"
1617
TEXT2 = "Walrus"
1718

19+
pytest.skip(reason='request function mocking is buggy here, skipping tests until '
20+
'https://github.com/astropy/astroquery/issues/2632 is resolved',
21+
allow_module_level=True)
22+
1823

1924
def set_response(resp_text, resp_status=200):
2025
"""Function that allows us to set a specific mock response for cache testing"""

0 commit comments

Comments
 (0)