@@ -204,24 +204,30 @@ def close(self, remove_tree=True):
204
204
if remove_tree :
205
205
shutil .rmtree (self .temp_dir_base )
206
206
207
+ ############################################################################
207
208
208
209
209
210
def _setup_influxdb_server (inst ):
210
211
inst .influxd_inst = InfluxDbInstance (inst .influxdb_template_conf )
211
212
inst .cli = InfluxDBClient ('localhost' ,
212
213
inst .influxd_inst .broker_port ,
213
214
'root' , '' , database = 'db' )
215
+
216
+
214
217
def _unsetup_influxdb_server (inst ):
215
218
remove_tree = sys .exc_info () == (None , None , None )
216
219
inst .influxd_inst .close (remove_tree = remove_tree )
217
220
221
+ ############################################################################
222
+
218
223
219
224
class SingleTestCaseWithServerMixin (object ):
220
225
''' A mixin for unittest.TestCase to start an influxdb server instance
221
226
in a temporary directory **for each test function/case**
222
227
'''
223
228
224
- # 'influxdb_template_conf' attribute must be set on the TestCase class or instance.
229
+ # 'influxdb_template_conf' attribute must be set
230
+ # on the TestCase class or instance.
225
231
226
232
setUp = _setup_influxdb_server
227
233
tearDown = _unsetup_influxdb_server
@@ -249,6 +255,8 @@ def tearDownClass(cls):
249
255
def tearDown (self ):
250
256
self .cli .drop_database ('db' )
251
257
258
+ ############################################################################
259
+
252
260
253
261
@unittest .skipIf (not is_influxdb_bin_ok , "could not find influxd binary" )
254
262
class SimpleTests (SingleTestCaseWithServerMixin ,
@@ -294,6 +302,7 @@ def test_query_fail(self):
294
302
('500: {"results":[{"error":"database not found: db"}]}' ,),
295
303
ctx .exception .args )
296
304
305
+ ############################################################################
297
306
298
307
299
308
@unittest .skipIf (not is_influxdb_bin_ok , "could not find influxd binary" )
@@ -508,6 +517,8 @@ def test_create_retention_policy(self):
508
517
rsp
509
518
)
510
519
520
+ ############################################################################
521
+
511
522
512
523
@unittest .skipIf (not is_influxdb_bin_ok , "could not find influxd binary" )
513
524
class UdpTests (ManyTestCasesWithServerMixin ,
0 commit comments