tests: teardown fixes
Add few missing app.close() calls on test teardown. Fix socket cleanup in TC_00_QubesDaemonProtocol() - not only close the FD, but also unregister it from asyncio event loop.
This commit is contained in:
parent
a90e7e365e
commit
0341cc5258
@ -109,8 +109,12 @@ class TC_00_QubesDaemonProtocol(qubes.tests.QubesTestCase):
|
|||||||
connect_coro)
|
connect_coro)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.sock_server.close()
|
self.writer.close()
|
||||||
self.sock_client.close()
|
try:
|
||||||
|
self.loop.run_until_complete(self.writer.wait_closed())
|
||||||
|
except AttributeError: # old python in travis
|
||||||
|
pass
|
||||||
|
self.transport.close()
|
||||||
super(TC_00_QubesDaemonProtocol, self).tearDown()
|
super(TC_00_QubesDaemonProtocol, self).tearDown()
|
||||||
|
|
||||||
def test_000_message_ok(self):
|
def test_000_message_ok(self):
|
||||||
|
@ -480,6 +480,9 @@ class TC_89_QubesEmpty(qubes.tests.QubesTestCase):
|
|||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
self.app.default_fw_netvm
|
self.app.default_fw_netvm
|
||||||
|
|
||||||
|
self.app.close()
|
||||||
|
del self.app
|
||||||
|
|
||||||
with self.subTest('loop'):
|
with self.subTest('loop'):
|
||||||
with open('/tmp/qubestest.xml', 'w') as xml_file:
|
with open('/tmp/qubestest.xml', 'w') as xml_file:
|
||||||
xml_file.write(xml_template.format(
|
xml_file.write(xml_template.format(
|
||||||
@ -502,6 +505,9 @@ class TC_89_QubesEmpty(qubes.tests.QubesTestCase):
|
|||||||
with self.assertRaises(AttributeError):
|
with self.assertRaises(AttributeError):
|
||||||
self.app.default_fw_netvm
|
self.app.default_fw_netvm
|
||||||
|
|
||||||
|
self.app.close()
|
||||||
|
del self.app
|
||||||
|
|
||||||
|
|
||||||
class TC_90_Qubes(qubes.tests.QubesTestCase):
|
class TC_90_Qubes(qubes.tests.QubesTestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
@ -131,6 +131,7 @@ class TC_00_ThinPool(ThinPoolBase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
super(TC_00_ThinPool, self).tearDown()
|
super(TC_00_ThinPool, self).tearDown()
|
||||||
os.unlink(self.app.store)
|
os.unlink(self.app.store)
|
||||||
|
self.app.close()
|
||||||
del self.app
|
del self.app
|
||||||
for attr in dir(self):
|
for attr in dir(self):
|
||||||
if isinstance(getattr(self, attr), qubes.vm.BaseVM):
|
if isinstance(getattr(self, attr), qubes.vm.BaseVM):
|
||||||
@ -1141,6 +1142,7 @@ class TC_02_StorageHelpers(ThinPoolBase):
|
|||||||
self.thin_dir.cleanup()
|
self.thin_dir.cleanup()
|
||||||
super(TC_02_StorageHelpers, self).tearDown()
|
super(TC_02_StorageHelpers, self).tearDown()
|
||||||
os.unlink(self.app.store)
|
os.unlink(self.app.store)
|
||||||
|
self.app.close()
|
||||||
del self.app
|
del self.app
|
||||||
for attr in dir(self):
|
for attr in dir(self):
|
||||||
if isinstance(getattr(self, attr), qubes.vm.BaseVM):
|
if isinstance(getattr(self, attr), qubes.vm.BaseVM):
|
||||||
|
Loading…
Reference in New Issue
Block a user