18
18
19
19
from pyvo .auth import authsession
20
20
21
-
22
- # to run just one test during development, set this variable to True
23
- # and comment out the skipif of the single test to run.
24
- one_test = False
25
-
26
21
# Skip the very slow tests to avoid timeout errors
27
22
skip_slow = True
28
23
29
24
30
25
@pytest .mark .remote_data
31
26
class TestCadcClass :
32
27
# now write tests for each method here
33
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
34
28
def test_get_collections (self ):
35
29
cadc = Cadc ()
36
30
result = cadc .get_collections ()
@@ -50,7 +44,6 @@ def test_get_collections(self):
50
44
assert 'Infrared' in result ['DAO' ]['Bands' ]
51
45
assert 'Optical' in result ['DAO' ]['Bands' ]
52
46
53
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
54
47
def test_query_region (self ):
55
48
cadc = Cadc ()
56
49
result = cadc .query_region ('08h45m07.5s +54d18m00s' , collection = 'CFHT' )
@@ -76,7 +69,6 @@ def test_query_region(self):
76
69
results = cadc .query_region (SkyCoord .from_name ('M31' ), radius = 0.016 )
77
70
assert len (results ) > 20
78
71
79
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
80
72
def test_query_name (self ):
81
73
cadc = Cadc ()
82
74
result1 = cadc .query_name ('M31-B14' )
@@ -85,7 +77,6 @@ def test_query_name(self):
85
77
result2 = cadc .query_name ('m31-b14' )
86
78
assert len (result1 ) == len (result2 )
87
79
88
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
89
80
def test_query (self ):
90
81
cadc = Cadc ()
91
82
result = cadc .exec_sync (
@@ -99,7 +90,6 @@ def test_query(self):
99
90
result = cadc .exec_sync (query )
100
91
assert len (result ) == 0
101
92
102
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
103
93
@pytest .mark .skip ('Disabled for now until pyvo starts supporting '
104
94
'different output formats' )
105
95
def test_query_format (self ):
@@ -108,7 +98,6 @@ def test_query_format(self):
108
98
result = cadc .exec_sync (query , output_format = 'csv' )
109
99
print (result )
110
100
111
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
112
101
@pytest .mark .skipif (('CADC_USER' not in os .environ
113
102
or 'CADC_PASSWD' not in os .environ ),
114
103
reason = 'Requires real CADC user/password (CADC_USER '
@@ -142,7 +131,6 @@ def test_login_with_user_password(self):
142
131
result = cadc .exec_sync (query )
143
132
assert len (result ) == 1
144
133
145
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
146
134
@pytest .mark .skipif ('CADC_CERT' not in os .environ ,
147
135
reason = 'Requires real CADC certificate (CADC_CERT '
148
136
'environment variable)' )
@@ -170,7 +158,6 @@ def test_login_with_cert(self):
170
158
result = cadc .exec_sync (query )
171
159
assert len (result ) == 0
172
160
173
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
174
161
@pytest .mark .skipif ('CADC_CERT' not in os .environ ,
175
162
reason = 'Requires real CADC certificate (CADC_CERT '
176
163
'environment variable)' )
@@ -192,7 +179,6 @@ def test_authsession(self):
192
179
result = cadc .exec_sync (query )
193
180
assert len (result ) == 0
194
181
195
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
196
182
@pytest .mark .xfail (reason = '#2325' )
197
183
def test_get_images (self ):
198
184
cadc = Cadc ()
@@ -204,7 +190,6 @@ def test_get_images(self):
204
190
for image in images :
205
191
assert isinstance (image , fits .HDUList )
206
192
207
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
208
193
@pytest .mark .skipif (skip_slow , reason = 'Avoid timeout errors' )
209
194
def test_get_images_against_AS (self ):
210
195
cadc = Cadc ()
@@ -238,7 +223,6 @@ def test_get_images_against_AS(self):
238
223
239
224
assert len (filtered_resp_urls ) == len (image_urls )
240
225
241
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
242
226
@pytest .mark .xfail (reason = '#2325' )
243
227
def test_get_images_async (self ):
244
228
cadc = Cadc ()
@@ -249,7 +233,6 @@ def test_get_images_async(self):
249
233
for obj in readable_objs :
250
234
assert isinstance (obj , FileContainer )
251
235
252
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
253
236
def test_async (self ):
254
237
# test async calls
255
238
cadc = Cadc ()
@@ -277,7 +260,6 @@ def test_async(self):
277
260
assert expected ['observationID' ][ii ] == result ['observationID' ][ii ]
278
261
# job.delete() # BUG in CADC
279
262
280
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
281
263
def test_list_tables (self ):
282
264
cadc = Cadc ()
283
265
table_names = cadc .get_tables (only_names = True )
@@ -293,7 +275,6 @@ def test_list_tables(self):
293
275
table = cadc .get_table ('caom2.Observation' )
294
276
assert 'caom2.Observation' == table .name
295
277
296
- @pytest .mark .skipif (one_test , reason = 'One test mode' )
297
278
@pytest .mark .skipif ('CADC_CERT' not in os .environ ,
298
279
reason = 'Requires real CADC certificate (CADC_CERT '
299
280
'environment variable)' )
0 commit comments