Need a dbus method to inspect dbus call log
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-dbusmock |
Fix Released
|
Undecided
|
Robert Bruce Park |
Bug Description
Problem: The only way to confirm that my application has called the correct dbus methods, is to capture STDOUT from dbusmock and analyze it's contents, looking for the right method names and call signatures.
This is fine when your testsuite is written in python and is running inside the same process as dbusmock, you have a lot of control to redirect STDOUT and analyze it.
But this becomes quite a limiting factor when the testsuite is written in a different language: What happens is you call dbus methods in order to set up the mocks, but then your tests are running in a separate process, and it can be difficult to capture that STDOUT.
Obviously you might say "well, just pipe the STDOUT from the python process to the STDIN of your testsuite process and analyze it that way", except that what if we are using dbus-test-runner? testsuite invocation looks like this:
xvfb-run dbus-test-runner --max-wait=0 --task python3 -p -m -p dbusmock -p com.canonical.
How do you pipe one to the other? I don't think dbus-test-runner supports such a feature ;-)
So it would be better if dbusmock kept a log of the mock calls/signatures that could be queried over dbus directly. I expect this would require two new dbus methods in order to work. One like 'QueryCalls' and one like 'ClearLog'. The idea being that each individual unit test would want to start off with a clean slate (no leaking state between tests), so start by clearing the log, then do something that triggers one or many dbus method calls, then end by calling QueryCalls and check that the expected call signatures are present in the log.
Related branches
- Martin Pitt: Approve
- Robert Bruce Park (community): Approve
-
Diff: 105 lines (+70/-0)2 files modifieddbusmock/mockobject.py (+23/-0)
tests/test_api.py (+47/-0)
Changed in python-dbusmock: | |
status: | New → In Progress |
assignee: | nobody → Robert Bruce Park (robru) |
Fixed in http:// bazaar. launchpad. net/~pitti/ python- dbusmock/ trunk/revision/ 100.