Skip to content

Commit c97f304

Browse files
authored
Merge pull request #2604 from bsipocz/MAINT_ignore_warninng
MAINT: do the warning ignore in test
2 parents f59362b + 9997f1b commit c97f304

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

astroquery/cadc/tests/test_cadctap.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
22
"""
33
=============
4-
CadcClass TAP plus
4+
CadcClass TAP
55
=============
66
77
"""
@@ -20,13 +20,20 @@
2020
from astropy import units as u
2121
import pytest
2222
import requests
23+
import warnings
2324

2425
from pyvo.auth import securitymethods
2526
from astroquery.cadc import Cadc, conf
2627
import astroquery.cadc.core as cadc_core
2728

2829
from unittest.mock import Mock, patch, PropertyMock
2930

31+
try:
32+
# workaround for https://github.com/astropy/astroquery/issues/2523 to support bs4<4.11
33+
from bs4.builder import XMLParsedAsHTMLWarning
34+
except ImportError:
35+
XMLParsedAsHTMLWarning = None
36+
3037

3138
def data_path(filename):
3239
data_dir = os.path.join(os.path.dirname(__file__), 'data')
@@ -191,9 +198,14 @@ def raise_for_status(self):
191198
with patch.object(cadc_core.requests, 'get', get):
192199
cadc_core.get_access_url.caps = {}
193200
assert 'http://my.org/mytap' == cadc_core.get_access_url('mytap')
194-
assert 'https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/argus/tables' == \
195-
cadc_core.get_access_url('mytap',
196-
'ivo://ivoa.net/std/VOSI#tables-1.1')
201+
202+
# Remove this filter when https://github.com/astropy/astroquery/issues/2523 is fixed
203+
with warnings.catch_warnings():
204+
if XMLParsedAsHTMLWarning:
205+
warnings.filterwarnings("ignore", category=XMLParsedAsHTMLWarning)
206+
207+
assert 'https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/argus/tables' == \
208+
cadc_core.get_access_url('mytap', 'ivo://ivoa.net/std/VOSI#tables-1.1')
197209

198210

199211
@patch('astroquery.cadc.core.get_access_url',

setup.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ filterwarnings =
5050
# utils.commons.parse_coordinates, we should remove its usage:
5151
ignore:Coordinate string is being interpreted as an ICRS coordinate:astroquery.exceptions.InputWarning
5252
ignore:Coordinate string is being interpreted as an ICRS coordinate:UserWarning
53-
# To be removed with a fix for https://github.com/astropy/astroquery/issues/2523
54-
ignore::bs4.builder.XMLParsedAsHTMLWarning
5553
# To be removed with a fix for https://github.com/astropy/astroquery/issues/2242
5654
ignore::astropy.io.votable.exceptions.E02
5755
# Warnings from yet to be refactored or to be removed modules

0 commit comments

Comments
 (0)