From 4f62fdfd29f574333ad4350b28045193057fd047 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 6 Sep 2021 18:57:06 +0100 Subject: [PATCH] tests: Fix subsequent tests after first power-profile test failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the first power-profile installed test fails (for example, because xdg-desktop-portal isn’t available), correctly tear down the dbusmock object, or it will cause setUp() to fail when the next test in the suite is run. Signed-off-by: Philip Withnall Helps: #2481 --- gio/tests/power-profile-monitor-portal.py.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gio/tests/power-profile-monitor-portal.py.in b/gio/tests/power-profile-monitor-portal.py.in index 8f6232cff..09e9a450d 100755 --- a/gio/tests/power-profile-monitor-portal.py.in +++ b/gio/tests/power-profile-monitor-portal.py.in @@ -66,12 +66,16 @@ try: try: self.xdp = subprocess.Popen([XDG_DESKTOP_PORTAL_PATH]) except FileNotFoundError: + self.p_mock.terminate() + self.p_mock.wait() raise unittest.SkipTest("xdg-desktop-portal not available") try: self.wait_for_bus_object('org.freedesktop.portal.Desktop', '/org/freedesktop/portal/desktop') except: + self.p_mock.terminate() + self.p_mock.wait() raise # subprocess.Popen(['gdbus', 'monitor', '--session', '--dest', 'org.freedesktop.portal.Desktop'])