Rev 5432: (gz) Display the correct test count at the start when selftest is run in in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Sep 17 15:27:29 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5432 [merge]
revision-id: pqm at pqm.ubuntu.com-20100917142727-49blehg006i4nc9n
parent: pqm at pqm.ubuntu.com-20100917091211-1e9h9nf6bsdjr6bd
parent: gzlist at googlemail.com-20100915161923-woyiyepk2f802nl7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-09-17 15:27:27 +0100
message:
(gz) Display the correct test count at the start when selftest is run in
verbose mode (Martin [gz])
modified:
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2010-09-17 06:59:59 +0000
+++ b/bzrlib/tests/__init__.py 2010-09-17 14:27:27 +0000
@@ -471,8 +471,8 @@
self.pb.finished()
super(TextTestResult, self).stopTestRun()
- def startTestRun(self):
- super(TextTestResult, self).startTestRun()
+ def report_tests_starting(self):
+ super(TextTestResult, self).report_tests_starting()
self.pb.update('[test 0/%d] Starting' % (self.num_tests))
def _progress_prefix_text(self):
@@ -546,9 +546,9 @@
result = a_string
return result.ljust(final_width)
- def startTestRun(self):
- super(VerboseTestResult, self).startTestRun()
+ def report_tests_starting(self):
self.stream.write('running %d tests...\n' % self.num_tests)
+ super(VerboseTestResult, self).report_tests_starting()
def report_test_start(self, test):
name = self._shortened_test_description(test)
=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py 2010-09-17 04:35:23 +0000
+++ b/bzrlib/tests/test_selftest.py 2010-09-17 14:27:27 +0000
@@ -1236,6 +1236,18 @@
self.assertContainsRe(output_string, "--date [0-9.]+")
self.assertLength(1, self._get_source_tree_calls)
+ def test_verbose_test_count(self):
+ """A verbose test run reports the right test count at the start"""
+ suite = TestUtil.TestSuite([
+ unittest.FunctionTestCase(lambda:None),
+ unittest.FunctionTestCase(lambda:None)])
+ self.assertEqual(suite.countTestCases(), 2)
+ stream = StringIO()
+ runner = tests.TextTestRunner(stream=stream, verbosity=2)
+ # Need to use the CountingDecorator as that's what sets num_tests
+ result = self.run_test_runner(runner, tests.CountingDecorator(suite))
+ self.assertStartsWith(stream.getvalue(), "running 2 tests")
+
def test_startTestRun(self):
"""run should call result.startTestRun()"""
calls = []
More information about the bazaar-commits
mailing list