Skip to content

Commit d422bc1

Browse files
committed
MNT: Do not use deprecated test helper funcs
1 parent 04f4312 commit d422bc1

File tree

5 files changed

+11
-21
lines changed

5 files changed

+11
-21
lines changed

astroquery/esa/hubble/tests/test_esa_hubble_remote.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,12 @@
1313
"""
1414
import tempfile
1515

16-
import unittest
1716
import os
1817

1918
import pytest
20-
from astropy.tests.helper import remote_data
21-
from requests.models import Response
2219
from astroquery.esa.hubble import ESAHubble
23-
from astroquery.utils.testing_tools import MockResponse
2420
from astropy import coordinates
25-
from unittest.mock import MagicMock
26-
from astropy.table.table import Table
27-
import shutil
2821
import random
29-
from PIL import Image
30-
3122

3223
esa_hubble = ESAHubble()
3324

astroquery/mast/tests/test_mast.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import os
44
import re
5-
65
from shutil import copyfile
76

7+
import pytest
8+
89
from astropy.table import Table
9-
from astropy.tests.helper import pytest
1010
from astropy.coordinates import SkyCoord
1111
from astropy.io import fits
1212

@@ -667,15 +667,15 @@ def test_zcut_download_cutouts(patch_post, tmpdir):
667667

668668
# Testing with png
669669
cutout_table = mast.Zcut.download_cutouts(coordinates=coord, size=5,
670-
cutout_format="jpg", path=str(tmpdir))
670+
cutout_format="jpg", path=str(tmpdir))
671671
assert isinstance(cutout_table, Table)
672672
assert len(cutout_table) == 3
673673
assert cutout_table["Local Path"][0][-4:] == ".jpg"
674674
assert os.path.isfile(cutout_table[0]['Local Path'])
675675

676676
# Testing with img_param
677677
cutout_table = mast.Zcut.download_cutouts(coordinates=coord, size=5,
678-
cutout_format="jpg", path=str(tmpdir), invert=True)
678+
cutout_format="jpg", path=str(tmpdir), invert=True)
679679
assert isinstance(cutout_table, Table)
680680
assert len(cutout_table) == 3
681681
assert cutout_table["Local Path"][0][-4:] == ".jpg"

astroquery/noirlab/tests/test_noirlab_remote.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
# Python library
33

44
# External packages
5+
import pytest
56
from astropy import units as u
67
from astropy.coordinates import SkyCoord
7-
from astropy.tests.helper import remote_data
8+
89
# Local packages
910
from .. import Noirlab
1011
from . import expected as expsia
11-
# #!import pytest
1212

1313
# performs similar tests as test_module.py, but performs
1414
# the actual HTTP request rather than monkeypatching them.
1515
# should be disabled or enabled at will - use the
16-
# remote_data decorator from astropy:
16+
# remote_data decorator from pytest-remotedata:
1717

1818

19-
@remote_data
19+
@pytest.mark.remote_data
2020
class TestNoirlabClass:
2121

2222
def test_query_region_1(self):

astroquery/vo_conesearch/validator/tests/test_validate.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
from numpy.testing import assert_allclose
1919

2020
# ASTROPY
21-
from astropy.tests.helper import catch_warnings
2221
from astropy.utils.data import get_pkg_data_filename
22+
from astropy.utils.exceptions import AstropyUserWarning
2323

2424
# LOCAL
2525
from .. import conf, validate, tstquery
@@ -83,9 +83,8 @@ def teardown_class(self):
8383

8484
@pytest.mark.remote_data
8585
def test_tstquery():
86-
with catch_warnings() as w:
86+
with pytest.warns(AstropyUserWarning, match='too large') as w:
8787
d = tstquery.parse_cs('ivo://cds.vizier/i/252', cap_index=4)
8888
assert len(w) == 1
89-
assert 'too large' in str(w[0].message)
9089
assert_allclose([d['RA'], d['DEC'], d['SR']],
9190
[45, 0.07460390065517808, 0.1])

docs/testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ the ``test_module.py`` file.
8585
-------------------------
8686

8787
The remote tests are much easier. Just decorate the test class or test
88-
functions with ``astropy.tests.helper.remote_data``.
88+
functions with ``@pytest.mark.remote_data``.
8989

9090
``setup_package.py``
9191
--------------------

0 commit comments

Comments
 (0)