summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2021-09-06 18:57:06 +0100
committerPhilip Withnall <pwithnall@endlessos.org>2021-09-06 18:57:06 +0100
commit4f62fdfd29f574333ad4350b28045193057fd047 (patch)
treec8b71afcfd1eb2055195c3565835fd81a8d7ee77
parentd051ef16111ccf82d0ffd84f6491ebad688318c5 (diff)
downloadglib-4f62fdfd29f574333ad4350b28045193057fd047.tar.gz
tests: Fix subsequent tests after first power-profile test failure
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 <pwithnall@endlessos.org> Helps: #2481
-rwxr-xr-xgio/tests/power-profile-monitor-portal.py.in4
1 files changed, 4 insertions, 0 deletions
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'])