Merge lp:~jml/testrepository/show-failures-incrementally-613152 into lp:~testrepository/testrepository/trunk
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Merged at revision: | 100 | ||||
| Proposed branch: | lp:~jml/testrepository/show-failures-incrementally-613152 | ||||
| Merge into: | lp:~testrepository/testrepository/trunk | ||||
| Diff against target: |
884 lines (+334/-143) 16 files modified
testrepository/commands/__init__.py (+0/-21) testrepository/commands/failing.py (+21/-22) testrepository/commands/last.py (+7/-15) testrepository/commands/load.py (+15/-15) testrepository/results.py (+13/-0) testrepository/tests/__init__.py (+17/-0) testrepository/tests/commands/test_failing.py (+16/-7) testrepository/tests/commands/test_last.py (+3/-5) testrepository/tests/commands/test_load.py (+9/-6) testrepository/tests/test_matchers.py (+17/-0) testrepository/tests/test_results.py (+28/-0) testrepository/tests/test_ui.py (+9/-8) testrepository/tests/ui/test_cli.py (+63/-5) testrepository/ui/__init__.py (+49/-12) testrepository/ui/cli.py (+22/-24) testrepository/ui/model.py (+45/-3) |
||||
| To merge this branch: | bzr merge lp:~jml/testrepository/show-failures-incrementally-613152 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Robert Collins | 2010-08-04 | Approve on 2010-09-26 | |
|
Review via email:
|
|||
Commit Message
Show test failures and errors as we get them in testr load.
Description of the Change
In the Wikipedia spirit of editing boldly, I've hacked up testrepository to show failures incrementally. Most of the damage occurs in the UI contract.
Here's what I've done:
* Added UI.make_result to the public interface, requiring a UI
to be responsible for making its object.
* Changed 'failing', 'load' and 'last' to use the result
provided by the UI, rather than making their own staging
result object to capture the stream.
* Change Command.output_run to no longer take an output stream,
as such a thing is no longer required -- the UI's result takes
care of it now.
* Dropped UI.output_results, since there's no longer any actual
use case.
* Gave the CLI UI a TestResult implementation that prints errors
and failures as it gets them.
Changing 'last' and 'failing' wasn't really necessary to fix bug 613152, neither was removing UI.output_results or changing Command.output_run, but it seemed better to me to go the whole hog.
I also cleaned up pyflakes warnings where I saw them.
- 106. By Jonathan Lange on 2010-08-04
-
Remove output_results, not needed.
| Jelmer Vernooij (jelmer) wrote : | # |
| Jonathan Lange (jml) wrote : | # |
Still need a review for this.
| Robert Collins (lifeless) wrote : | # |
output_run looks like it doesn't output a run anymore: its intent is sufficiently different, I would like it to actually match.
output_run_summary, perhaps.
or
output_result, which seems to be what it does now.
I think things are a little confused in fact; it looks to me that the summary printing at the end of the result wants to happen in the stopRun method of the result resturned from makeResult, and output_run can be wholly deleted.
You've added a TODO which there is an example of doing that TODO elsewhere in your diff.
The rest looks ok.
Thanks for doing this, it is appreciated, I've just been stupidly busy bootstrapping stuff in lp.
- 107. By Jonathan Lange on 2010-09-12
-
Merge trunk, doing major work to resolve the conflict in the failing command.
- 108. By Jonathan Lange on 2010-09-12
-
make_result now takes a callable that returns the id of the test run.
Not actually used yet. - 109. By Jonathan Lange on 2010-09-12
-
Refactor the CLITestResult tests so they don't care so much about how results
are constructed. - 110. By Jonathan Lange on 2010-09-19
-
Wildcard object equal to everything.
- 111. By Jonathan Lange on 2010-09-19
-
Use Wildcard to make matching UI output a little nicer.
- 112. By Jonathan Lange on 2010-09-20
-
Give the UI's TestResult object full responsibility for summing up the result
of the test, - 113. By Jonathan Lange on 2010-09-20
-
Oops.
- 114. By Jonathan Lange on 2010-09-20
-
Delete unused output_run.
- 115. By Jonathan Lange on 2010-09-20
-
Tests for results module.
- 116. By Jonathan Lange on 2010-09-20
-
Probably not.
| Jonathan Lange (jml) wrote : | # |
As indicated on IRC, I didn't add a TODO, I just moved it.
It took me a while to refactor the code to use stopTestRun rather than output_run. I have had to change some of the behaviour to do so.
Specifically:
* 'testr failing' now shows run id, total tests and skip count as well failure count
* 'testr failing' now has return code 1 when there are failing tests
* 'testr load' will show skips
There's probably other stuff, although I tried to minimize it. Big enough that it definitely needs review.
| Robert Collins (lifeless) wrote : | # |
+ def _make_result(self, repo, evaluator):
+ if self.ui.
+ return evaluator
this two things seem disconnected; perhaps rather than evaluator you should say list_result or something. I think something originally together has been split out far enough that the parameter needs a better name.
+Wildcard = _Wildcard()
perhaps
wildcard = Wildcard()
would be nicer. Many things (like str, object, etc) are lowercase for instances in Python.
+ def _output_run(self, run_id):
def _output_summary
- I think.
+ return ''.join([
+ self.sep1,
+ '%s: %s\n' % (label, test.id()),
+ self.sep2,
+ error_text,
+ ])
Looks like a lurking UnicodeDecodeError to me; we either need to make this unicode always or manually encode error. One way to test that would be to throw a mixed encoding, non-ascii test outcome at it.
Would you be kind enough to do these tweaks? then its definitely gtg.
| Jonathan Lange (jml) wrote : | # |
On Sun, Sep 26, 2010 at 9:46 AM, Robert Collins
<email address hidden> wrote:
> Review: Approve
> + def _make_result(self, repo, evaluator):
> + if self.ui.
> + return evaluator
>
> this two things seem disconnected; perhaps rather than evaluator you should say list_result or something. I think something originally together has been split out far enough that the parameter needs a better name.
Done.
>
>
> +Wildcard = _Wildcard()
>
> perhaps
> wildcard = Wildcard()
>
> would be nicer. Many things (like str, object, etc) are lowercase for instances in Python.
>
Instances of 'type', perhaps. I chose the case to reflect None, True
and False: other singleton constants in Python.
>
> + def _output_run(self, run_id):
>
> def _output_summary
>
> - I think.
>
Changed.
>
> + return ''.join([
> + self.sep1,
> + '%s: %s\n' % (label, test.id()),
> + self.sep2,
> + error_text,
> + ])
>
> Looks like a lurking UnicodeDecodeError to me; we either need to make this unicode always or manually encode error. One way to test that would be to throw a mixed encoding, non-ascii test outcome at it.
Well, it's not a *new* lurking UnicodeDecodeError. It's equivalent to
what was there earlier.
We are always going to be getting the error_text from the base
TestResult. In this case, we are relying on testtools to store
unicode. I've changed all of the literals to be unicode to at least
communicate this more clearly.
I was going to add a test (below), but it seems to be a case of
"Doctor, it hurts when I do this!".
def test_format_
result = self.make_result()
error_text = 'foo' + u'проба'
error = result.
expected = u'%s%s: %s\n%s%s' % (
>
> Would you be kind enough to do these tweaks? then its definitely gtg.
Thanks,
jml
| Jelmer Vernooij (jelmer) wrote : | # |
W00t!

I can't find the "I like this" button.