|
1 | 1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
|
2 | 2 | from __future__ import print_function
|
3 | 3 |
|
4 |
| -# astroquery uses the pytest framework for testing |
5 |
| -# this is already available in astropy and does |
6 |
| -# not require a separate install. Import it using: |
7 | 4 | import pytest
|
8 | 5 |
|
9 |
| -# It would be best if tests are separated in two |
10 |
| -# modules. This module performs tests on local data |
11 |
| -# by mocking HTTP requests and responses. To test the |
12 |
| -# same functions on the remote server, put the relevant |
13 |
| -# tests in the 'test_module_remote.py' |
14 |
| - |
15 |
| -# Now import other commonly used modules for tests |
16 | 6 | import os
|
17 | 7 | import requests
|
18 | 8 |
|
|
23 | 13 |
|
24 | 14 | from ...utils.testing_tools import MockResponse
|
25 | 15 |
|
26 |
| -# finally import the module which is to be tested |
27 |
| -# and the various configuration items created |
28 |
| -from ... import template_module |
29 |
| -from ...template_module import conf |
| 16 | +from ... import higal |
| 17 | +from ...higal import conf |
30 | 18 |
|
31 | 19 | # Local tests should have the corresponding data stored
|
32 | 20 | # in the ./data folder. This is the actual HTTP response
|
@@ -71,15 +59,12 @@ def patch_request(request):
|
71 | 59 | mp = request.getfixturevalue("monkeypatch")
|
72 | 60 | except AttributeError: # pytest < 3
|
73 | 61 | mp = request.getfuncargvalue("monkeypatch")
|
74 |
| - mp.setattr(template_module.core.TemplateClass, '_request', |
| 62 | + mp.setattr(higal.core.HiGalClass, '_request', |
75 | 63 | nonremote_request)
|
76 | 64 | return mp
|
77 | 65 |
|
78 | 66 |
|
79 | 67 | # finally test the methods using the mock HTTP response
|
80 | 68 | def test_query_object(patch_request):
|
81 |
| - result = template_module.core.TemplateClass().query_object('m1') |
| 69 | + result = higal.core.HiGalClass().query_object('m1') |
82 | 70 | assert isinstance(result, Table)
|
83 |
| - |
84 |
| -# similarly fill in tests for each of the methods |
85 |
| -# look at tests in existing modules for more examples |
0 commit comments