From 9172a7708dfc102192d188b265c9b13805f64570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 29 Sep 2017 03:39:22 +0200 Subject: [PATCH] tests: fix various object leaks cont Do not use self.fail when handling exception - this will keep exception object referenced, which in turn have reference to domain object (via traceback). --- qubes/tests/integ/network.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qubes/tests/integ/network.py b/qubes/tests/integ/network.py index a2750b22..985eb434 100644 --- a/qubes/tests/integ/network.py +++ b/qubes/tests/integ/network.py @@ -481,14 +481,16 @@ class VmNetworkingMixin(object): self.loop.run_until_complete(self.proxy.run_for_stdio( cmd, user='root')) except subprocess.CalledProcessError as e: - self.fail('{} failed with: {}'.format(cmd, e.returncode)) + raise AssertionError( + '{} failed with: {}'.format(cmd, e.returncode)) from None try: cmd = 'iptables -I INPUT -s {} -j ACCEPT'.format(self.testvm2.ip) self.loop.run_until_complete(self.proxy.run_for_stdio( cmd, user='root')) except subprocess.CalledProcessError as e: - self.fail('{} failed with: {}'.format(cmd, e.returncode)) + raise AssertionError( + '{} failed with: {}'.format(cmd, e.returncode)) from None self.assertEqual(self.run_cmd(self.testvm2, self.ping_cmd.format(target=self.testvm1.ip)), 0) @@ -498,8 +500,8 @@ class VmNetworkingMixin(object): (stdout, _) = self.loop.run_until_complete( self.testvm1.run_for_stdio(cmd, user='root')) except subprocess.CalledProcessError as e: - self.fail( - '{} failed with {}'.format(cmd, e.returncode)) + raise AssertionError( + '{} failed with {}'.format(cmd, e.returncode)) from None self.assertNotEqual(stdout.decode().split()[0], '0', 'Packets didn\'t managed to the VM')