Skip to content

Commit 5ca7593

Browse files
authored
Merge pull request #2059 from pllim/fix-vo-conesearch-tests
TST: Fix vo_conesearch test failures
2 parents f7940f9 + 3b1d8ec commit 5ca7593

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

astroquery/utils/commons.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ def FK4CoordGenerator(*args, **kwargs):
5252
'suppress_vo_warnings',
5353
'validate_email',
5454
'ASTROPY_LT_4_0',
55-
'ASTROPY_LT_4_1']
55+
'ASTROPY_LT_4_1',
56+
'ASTROPY_LT_4_3']
5657

5758
ASTROPY_LT_4_0 = not minversion('astropy', '4.0')
5859
ASTROPY_LT_4_1 = not minversion('astropy', '4.1')
60+
ASTROPY_LT_4_3 = not minversion('astropy', '4.3')
5961

6062

6163
def send_request(url, data, timeout, request_type='POST', headers={},

astroquery/utils/tests/test_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@ def patch_getreadablefileobj(request):
410410
# Monkeypatch hack: ALWAYS treat as a URL
411411
_is_url = aud._is_url
412412
aud._is_url = lambda x: True
413+
414+
if not commons.ASTROPY_LT_4_3:
415+
_try_url_open = aud._try_url_open
416+
aud._try_url_open = lambda x, **kwargs: MockRemote(x, **kwargs)
417+
413418
_urlopen = urllib.request.urlopen
414419
_urlopener = urllib.request.build_opener
415420
_urlrequest = urllib.request.Request
@@ -457,6 +462,10 @@ def monkey_urlrequest(x, *args, **kwargs):
457462

458463
def closing():
459464
aud._is_url = _is_url
465+
466+
if not commons.ASTROPY_LT_4_3:
467+
aud._try_url_open = _try_url_open
468+
460469
urllib.request.urlopen = _urlopen
461470
aud.urllib.request.urlopen = _urlopen
462471
urllib.request.build_opener = _urlopener

0 commit comments

Comments
 (0)