Add diagnostic output to testbed probe.redraw()
#1847
Labels
enhancement
New features, or improvements to existing features.
good first issue
Is this your first time contributing? This could be a good place to start!
What is the problem or limitation you are having?
When running the testbed with
--slow
, tests run slower, but it's difficult to establish what the test is meant to be doing unless you're familiar with the test.It would be desirable for a
--slow
test run to include debug output so that at eachawait probe.redraw()
wait step, the test describes what behavior the test is expecting to see.Describe the solution you'd like
probe.redraw()
should accept an optional string argument, that allows the test developer to describe what it is that the user should be waiting for - e.g.:The message should act as a form of inline documentation of the test cases. It should be a humanised summary of any assertions that follow the
redraw()
call.This message can be output with a
print()
call in the implementation ofprobe.redraw()
on each platform. However, the output should only occur if running in--slow
mode; and should occur before the 1s sleep (so we know what we're sleeping to see).Running in
--slow
mode should also turn on-s
in the call to pytest, so that streaming output is visible.If no message is provided, a default message of "Waiting for redraw") should be output.
The existing test cases in the testbed app should be updated to include meaningful probe redraw explanations.
It would also be desirable to include a "console clearing"
print("\n")
at the start of tests when running in slow mode. Otherwise, the first redraw wait will be on the line with the test name. The firstprobe.redraw()
should usually be in the setup of the probe itself, so including a\n
in that print message may be sufficient.Describe alternatives you've considered
Do nothing; or include ad-hoc debug statements as part of the test authoring process.
Additional context
To see the current testbed behaviour, set up a Toga development environment, and run:
To see the behavior in slow mode, run:
There is a separate probe.redraw() call in each platform's testbed probe.
Ultimately, it would be preferable for the string argument to probe.redraw() to not be optional. However, all existing tests would need to be updated before this could be enabled. A partial solution that uses an optional message and updates some of the testbed tests would be acceptable as a first pass.
The text was updated successfully, but these errors were encountered: