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:
parent
988ad5d2e8
commit
16a6c6affd
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue