diff options
author | Sascha Silbe <sascha-pgp@silbe.org> | 2011-05-14 17:25:16 (GMT) |
---|---|---|
committer | Sascha Silbe <sascha-pgp@silbe.org> | 2011-05-14 17:25:16 (GMT) |
commit | 521c0b0de1ff8b65a01cd8432ac4a11899cae590 (patch) | |
tree | 6a7b81249ce7fd71f6b69ad960c06600a1555c03 /tests | |
parent | 7ed2fa4fee85007b0c6b785d5e038d95d463b0bc (diff) |
runalltests.py: wait long enough between tests
For some unknown reason, we need to wait a bit more even after D-Bus
acknowledged the service has shut down. Otherwise the following exception will
happen when we first try to access the data store in the next test:
DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name :1.1 was
not provided by any .service files
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runalltests.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/runalltests.py b/tests/runalltests.py index fab15ce..50859c9 100755 --- a/tests/runalltests.py +++ b/tests/runalltests.py @@ -175,7 +175,12 @@ class TestSuiteWrapper(unittest.TestCase): def tearDown(self): self._kill_data_store() - #self._clean_data_store() + # For some unknown reason, we need to wait a bit more even after + # the process died and D-Bus acknowledged the service has shut down. + # On my system (Athlon BE 2300, 1.9GHz), 30ms were necessary. With + # 500ms we should be on the safe side. + time.sleep(.5) + self._clean_data_store() def _kill_data_store(self): pgrep = subprocess.Popen(['pgrep', '-g', os.environ['DBUS_PID'], @@ -191,7 +196,14 @@ class TestSuiteWrapper(unittest.TestCase): self._loop = gobject.MainLoop() self._bus.watch_name_owner(DS_DBUS_SERVICE, self._service_changed_cb) os.kill(pid, signal.SIGTERM) + # wait for D-Bus to acknowledge the service stopped self._loop.run() + # wait for process to finish + try: + os.waitpid(pid, 0) + except OSError, exception: + if exception.errno != errno.ECHILD: + raise def _service_changed_cb(self, new_owner): if not new_owner: |