PIM testing: better timeFunction()

The function now keeps the event loop running while waiting for
completion. That ensures that events get received immediately.

testpim.py now matches the po scanning process because of the _(' text
pattern. We need to exclude it explicitly.
This commit is contained in:
Patrick Ohly 2014-01-30 20:06:25 +01:00
parent 988ad5d2e8
commit 16a6c6affd
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,4 @@
src/gtk-ui/ui.xml
src/gtk-ui/gtkinfobar.c
src/synthesis/src/pcre/pcre_compile.c
src/dbus/server/pim/testpim.py

View File

@ -63,9 +63,15 @@ import testdbus
def timeFunction(func, *args1, **args2):
start = time.time()
res = func(*args1, **args2)
res = { }
args2['reply_handler'] = lambda x: (res.__setitem__('okay', x), loop.quit())
args2['error_handler'] = lambda x: (res.__setitem__('failed', x), loop.quit())
func(*args1, **args2)
loop.run()
end = time.time()
return (end - start, res)
if 'failed' in res:
raise res['failed']
return (end - start, res['okay'])
@unittest.skip("not a real test")
class ContactsView(dbus.service.Object, unittest.TestCase):