Commit 6308bc71 authored by Jérome Perrin's avatar Jérome Perrin

software/monitor/test: fix some ResourceWarnings

parent 5bcea991
...@@ -163,17 +163,18 @@ class EdgeMixin(object): ...@@ -163,17 +163,18 @@ class EdgeMixin(object):
) )
for instance_reference in self.surykatka_dict: for instance_reference in self.surykatka_dict:
for info_dict in self.surykatka_dict[instance_reference].values(): for info_dict in self.surykatka_dict[instance_reference].values():
self.assertEqual( with open(info_dict['ini-file']) as f:
info_dict['expected_ini'].strip() % info_dict, self.assertEqual(
open(info_dict['ini-file']).read().strip() info_dict['expected_ini'].strip() % info_dict,
) f.read().strip()
)
def assertPromiseContent(self, instance_reference, name, content): def assertPromiseContent(self, instance_reference, name, content):
promise = open( with open(
os.path.join( os.path.join(
self.slap.instance_directory, instance_reference, 'etc', 'plugin', name self.slap.instance_directory, instance_reference, 'etc', 'plugin', name
)).read().strip() )) as f:
promise = f.read().strip()
self.assertTrue(content in promise) self.assertTrue(content in promise)
def assertSurykatkaBotPromise(self): def assertSurykatkaBotPromise(self):
...@@ -191,10 +192,11 @@ class EdgeMixin(object): ...@@ -191,10 +192,11 @@ class EdgeMixin(object):
def assertSurykatkaCron(self): def assertSurykatkaCron(self):
for instance_reference in self.surykatka_dict: for instance_reference in self.surykatka_dict:
for info_dict in self.surykatka_dict[instance_reference].values(): for info_dict in self.surykatka_dict[instance_reference].values():
self.assertEqual( with open(info_dict['status-cron']) as f:
'*/2 * * * * %s' % (info_dict['status-json'],), self.assertEqual(
open(info_dict['status-cron']).read().strip() '*/2 * * * * %s' % (info_dict['status-json'],),
) f.read().strip()
)
def initiateSurykatkaRun(self): def initiateSurykatkaRun(self):
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment