[glib: 4/5] tests: Fix subsequent tests after first power-profile test failure




commit 4f62fdfd29f574333ad4350b28045193057fd047
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Sep 6 18:57:06 2021 +0100

    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

 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'])
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]