Skip to content

Commit b9384f9

Browse files
keflavichbsipocz
authored andcommitted
fix mocks (did these _ever_ work?)
1 parent b46834a commit b9384f9

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

astroquery/splatalogue/tests/test_splatalogue.py

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

77
from astropy import units as u
88

9-
from ... import splatalogue
9+
from astroquery.utils.mocks import MockResponse
10+
from astroquery import splatalogue
1011

1112

1213
SPLAT_DATA = 'CO.json'
@@ -23,8 +24,22 @@ def test_simple(patch_post):
2324
chemical_name=' CO ')
2425

2526

27+
def mockreturn(*args, method='POST', data={}, url='', **kwargs):
28+
with open(data_path("CO.json"), 'rb') as fh:
29+
jdata = fh.read()
30+
return MockResponse(content=jdata)
31+
32+
33+
@pytest.fixture
34+
def patch_post(request):
35+
mp = request.getfixturevalue("monkeypatch")
36+
37+
mp.setattr(splatalogue.Splatalogue, '_request', mockreturn)
38+
return mp
39+
40+
2641
@pytest.mark.remote_data
27-
def test_init_remote(patch_post):
42+
def test_init_remote():
2843
x = splatalogue.Splatalogue.query_lines(min_frequency=114 * u.GHz,
2944
max_frequency=116 * u.GHz,
3045
chemical_name=' CO ')

0 commit comments

Comments
 (0)