Merge lp:~jameinel/testrepository/load-progress into lp:~testrepository/testrepository/trunk

Proposed by John A Meinel
Status: Rejected
Rejected by: Robert Collins
Proposed branch: lp:~jameinel/testrepository/load-progress
Merge into: lp:~testrepository/testrepository/trunk
Diff against target: 68 lines (+25/-2)
2 files modified
.bzrignore (+1/-0)
testrepository/commands/load.py (+24/-2)
To merge this branch: bzr merge lp:~jameinel/testrepository/load-progress
Reviewer Review Type Date Requested Status
Robert Collins Disapprove
Review via email: mp+17685@code.launchpad.net
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

This adds

testr load -p

Which will display the bzr style progress. This helps when running

bzr selftest --subunit | testr load -p

Since it lets me know how far along things are going.

Note that it

1) Doesn't (yet) support -v
2) Is probably slightly overly verbose in standard mode because bzr's stopTestRun reports a lot of stuff. We could possibly stub out "stream.writeln" if we only wanted to report testr's summary.

Revision history for this message
Robert Collins (lifeless) wrote :

        Sadly, testrepository is apache/bsd and bzrlib is GPLv2: bzrlib
        can use
        testrepository but not vice versa.

        http://pypi.python.org/pypi/progressbar looks like it might be a
        viable
        progress bar to implement the feature you'd like.

        I'm totally in favour of the spirit of the patch - I'd like a -p
        option.

        Hmm, perhaps put the progress bar result into testtools itself,
        as other
        folk may want to use it too.

        -Rob

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> The proposal to merge lp:~jameinel/testrepository/load-progress into lp:testrepository has been updated.
>
> Status: Needs review => Work in progress

Fortunately as long as I don't distribute it, I get to keep using it for
now :).

I would like to see something come of this, but my initial itch is
scratched...

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktXjbkACgkQJdeBCYSNAAMw6gCdG900sEdaiPsXyOjmAb793Yym
tyQAnRfKGVg7q8pwcyxQpeTftDAUvGak
=siRN
-----END PGP SIGNATURE-----

Revision history for this message
Robert Collins (lifeless) wrote :

I'm going to mark this rejected - the license issue is fundamental, and after 2 years I suspect it won't be pushed forward, its also bitrotten I think, due to ui API cleanups.

review: Disapprove

Unmerged revisions

78. By John A Meinel

Implement a crude --progress for 'testr load'.

We already had a few result classes, this just adds one.
Also, it is a bit unfortunate that inserter.stopTestRun() has
a return value, as none of the other result classes do, and
MultiTestResult certainly doesn't return it.

I don't really understand why Robert called one startTestRun
and stopTestRun but didn't call all of them.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-12-24 09:46:40 +0000
3+++ .bzrignore 2010-01-19 20:22:10 +0000
4@@ -3,3 +3,4 @@
5 test.xml
6 build
7 .testrepository
8+./tags
9
10=== modified file 'testrepository/commands/load.py'
11--- testrepository/commands/load.py 2010-01-10 08:52:00 +0000
12+++ testrepository/commands/load.py 2010-01-19 20:22:10 +0000
13@@ -15,12 +15,25 @@
14 """Load data into a repository."""
15
16 from cStringIO import StringIO
17+import optparse
18
19 import subunit.test_results
20 from testtools import MultiTestResult, TestResult
21
22 from testrepository.commands import Command
23
24+
25+def get_bzrlib_result():
26+ import sys
27+ import unittest
28+ from bzrlib import ui, tests
29+ ui.ui_factory = ui.make_ui_for_terminal(None, sys.stdout, sys.stderr)
30+ # TODO: We should probably suppress stream.writeln instead...
31+ stream = unittest._WritelnDecorator(sys.stderr)
32+ result = tests.TextTestResult(stream, descriptions=0, verbosity=1)
33+ return result
34+
35+
36 class load(Command):
37 """Load a subunit stream into a repository.
38
39@@ -30,6 +43,9 @@
40
41 input_streams = ['subunit+']
42
43+ options = [optparse.Option("--progress", "-p", action="store_true",
44+ default=False, help="Output progress information while loading.")]
45+
46 def run(self):
47 path = self.ui.here
48 repo = self.repository_factory.open(path)
49@@ -42,11 +58,17 @@
50 filtered = subunit.test_results.TestResultFilter(output_stream,
51 filter_skip=True)
52 case = subunit.ProtocolTestCase(stream)
53- inserter.startTestRun()
54+ results = [inserter, evaluator, filtered]
55+ if self.ui.options.progress:
56+ results.append(get_bzrlib_result())
57+ combined_result = MultiTestResult(*results)
58+ combined_result.startTestRun()
59 try:
60- case.run(MultiTestResult(inserter, evaluator, filtered))
61+ case.run(combined_result)
62 finally:
63 run_id = inserter.stopTestRun()
64+ for res in results[1:]:
65+ res.stopTestRun()
66 failed = failed or not evaluator.wasSuccessful()
67 self.output_run(run_id, output, evaluator)
68 if failed:

Subscribers

People subscribed via source and target branches