Skip to content

Commit 5e3eebc

Browse files
keflavichbsipocz
authored andcommitted
mocks, etc., are set up in conftest
1 parent 35a0324 commit 5e3eebc

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

astroquery/splatalogue/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ def post_mockreturn(self, method, url, data=None, timeout=10, files=None,
2828
if method != 'POST':
2929
raise ValueError("A 'post request' was made with method != POST")
3030
filename = data_path(SPLAT_DATA)
31-
with open(filename, 'r') as infile:
32-
content = json.load(infile)
31+
with open(filename, 'rb') as infile:
32+
content = infile.read()
3333
return MockResponse(content, **kwargs)

astroquery/splatalogue/tests/test_splatalogue.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,6 @@
1010
from astroquery import splatalogue
1111

1212

13-
SPLAT_DATA = 'CO.json'
14-
15-
16-
def data_path(filename):
17-
data_dir = os.path.join(os.path.dirname(__file__), 'data')
18-
return os.path.join(data_dir, filename)
19-
20-
21-
def mockreturn(*args, method='POST', data={}, url='', **kwargs):
22-
with open(data_path("CO.json"), 'rb') as fh:
23-
jdata = fh.read()
24-
return MockResponse(content=jdata)
25-
26-
27-
@pytest.fixture
28-
def patch_post(request):
29-
mp = request.getfixturevalue("monkeypatch")
30-
31-
mp.setattr(splatalogue.Splatalogue, '_request', mockreturn)
32-
return mp
33-
34-
3513
def test_simple(patch_post):
3614
splatalogue.Splatalogue.query_lines(min_frequency=114 * u.GHz,
3715
max_frequency=116 * u.GHz,

0 commit comments

Comments
 (0)