diff options
authorMartin Pitt <>2016-12-02 10:41:48 +0100
committerMartin Pitt <>2016-12-02 10:44:06 +0100
commitf64106284d2ac0d522058ab6aee1b796bde8b0d2 (patch)
parentf99ca608e0d9911fae49f2fdeddb00fa78a5a382 (diff) Fix waiting for mock polkit to start
In the common case when we got a DBusException we previously skipped the time.sleep() and thus were just racing through the retry loop without actually giving the child process any time to start up. Also raise a proper exception on timeout instead of os.abort(). The latter did not flush stderr fast enough to actually see the failure message, and as this happens in the parent pid we actually can raise an exception meaningfully. LP: #1585382
1 files changed, 4 insertions, 6 deletions
diff --git a/src/tests/ b/src/tests/
index bd313bd..3274ee3 100755
--- a/src/tests/
+++ b/src/tests/
@@ -16,7 +16,6 @@ This also provides some convenience API for launching the daemon and for
writing unittest test cases involving polkit operations.
-import sys
import os
import argparse
import unittest
@@ -174,14 +173,13 @@ def spawn(allowed_actions, on_bus=None):
p = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'),
+ if p == pid:
+ break
except dbus.exceptions.DBusException:
- continue
- if p == pid:
- break
+ pass
- sys.stderr.write('test polkitd failed to start up\n')
- os.abort()
+ raise SystemError('test polkitd failed to start up')
return pid