Rev 2689: Add selftest --strict in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Aug 9 07:36:04 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2689
revision-id: pqm at pqm.ubuntu.com-20070809063601-esywbsbqp7zcs4x9
parent: pqm at pqm.ubuntu.com-20070809033454-r4dk8909z5zxspum
parent: mbp at sourcefrog.net-20070809055620-2tvrnr8v15h02fqh
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-08-09 07:36:01 +0100
message:
  Add selftest --strict
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
  doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
    ------------------------------------------------------------
    revno: 2687.1.1
    merged: mbp at sourcefrog.net-20070809055620-2tvrnr8v15h02fqh
    parent: pqm at pqm.ubuntu.com-20070809000503-7gad4qd85xll5ucf
    parent: d.m.watkins at warwick.ac.uk-20070731104202-vxpb2l2ew11s35rc
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: integration
    timestamp: Thu 2007-08-09 15:56:20 +1000
    message:
      Add selftest --strict
    ------------------------------------------------------------
    revno: 2658.3.6
    merged: d.m.watkins at warwick.ac.uk-20070731104202-vxpb2l2ew11s35rc
    parent: d.m.watkins at warwick.ac.uk-20070731103853-g8rsi4sggul6tx8h
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 111914
    timestamp: Tue 2007-07-31 11:42:02 +0100
    message:
      bzr selftest --strict'' fails if there are any missing features or expected test failures, as per bug #111914.
    ------------------------------------------------------------
    revno: 2658.3.5
    merged: d.m.watkins at warwick.ac.uk-20070731103853-g8rsi4sggul6tx8h
    parent: d.m.watkins at warwick.ac.uk-20070731103451-rq3i7wrpxwk0a6tl
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 111914
    timestamp: Tue 2007-07-31 11:38:53 +0100
    message:
      Added note regarding --strict to HACKING.
    ------------------------------------------------------------
    revno: 2658.3.4
    merged: d.m.watkins at warwick.ac.uk-20070731103451-rq3i7wrpxwk0a6tl
    parent: d.m.watkins at warwick.ac.uk-20070731103402-m3r94l098em3f2je
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 111914
    timestamp: Tue 2007-07-31 11:34:51 +0100
    message:
      'bzr selftest --strict' now fails if there are any unsupported features or tests that are known to fail.
    ------------------------------------------------------------
    revno: 2658.3.3
    merged: d.m.watkins at warwick.ac.uk-20070731103402-m3r94l098em3f2je
    parent: d.m.watkins at warwick.ac.uk-20070731103333-sdelcaazn0fxgaf3
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 111914
    timestamp: Tue 2007-07-31 11:34:02 +0100
    message:
      Added UI support for bzr selftest --strict.
    ------------------------------------------------------------
    revno: 2658.3.2
    merged: d.m.watkins at warwick.ac.uk-20070731103333-sdelcaazn0fxgaf3
    parent: d.m.watkins at warwick.ac.uk-20070731103259-spt2tajag1mtuzli
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 111914
    timestamp: Tue 2007-07-31 11:33:33 +0100
    message:
      Added tests for ExtendedTestResult.wasStrictlySuccessful.
    ------------------------------------------------------------
    revno: 2658.3.1
    merged: d.m.watkins at warwick.ac.uk-20070731103259-spt2tajag1mtuzli
    parent: pqm at pqm.ubuntu.com-20070728030946-tfjmxwe9y2eq1gzo
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 111914
    timestamp: Tue 2007-07-31 11:32:59 +0100
    message:
      Added ExtendedTestResult.wasStrictlySuccessful.
=== modified file 'NEWS'
--- a/NEWS	2007-08-09 03:34:54 +0000
+++ b/NEWS	2007-08-09 06:36:01 +0000
@@ -126,6 +126,9 @@
     * The cache of ignore definitions is now cleared in WorkingTree.unlock()
       so that changes to .bzrignore aren't missed. (#129694, Daniel Watkins)
 
+    * ``bzr selftest --strict'' fails if there are any missing features or
+      expected test failures. (Daniel Watkins, #111914)
+
   LIBRARY API BREAKS:
 
     * Deprecated dictionary ``bzrlib.option.SHORT_OPTIONS`` removed.

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-08-07 15:29:02 +0000
+++ b/bzrlib/builtins.py	2007-08-09 05:56:20 +0000
@@ -2510,6 +2510,8 @@
                             short_name='x',
                             help='Exclude tests that match this regular'
                                  ' expression.'),
+                     Option('strict', help='Fail on missing dependencies or '
+                            'known failures.'),
                      ]
     encoding_type = 'replace'
 
@@ -2517,7 +2519,7 @@
             transport=None, benchmark=None,
             lsprof_timed=None, cache_dir=None,
             first=False, list_only=False,
-            randomize=None, exclude=None):
+            randomize=None, exclude=None, strict=False):
         import bzrlib.ui
         from bzrlib.tests import selftest
         import bzrlib.benchmarks as benchmarks
@@ -2555,7 +2557,8 @@
                               matching_tests_first=first,
                               list_only=list_only,
                               random_seed=randomize,
-                              exclude_pattern=exclude
+                              exclude_pattern=exclude,
+                              strict=strict,
                               )
         finally:
             if benchfile is not None:

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-08-08 05:04:16 +0000
+++ b/bzrlib/tests/__init__.py	2007-08-09 05:56:20 +0000
@@ -323,6 +323,13 @@
     def report_success(self, test):
         pass
 
+    def wasStrictlySuccessful(self):
+        if self.unsupported or self.known_failure_count:
+            return False
+
+        return self.wasSuccessful()
+
+
 
 class TextTestResult(ExtendedTestResult):
     """Displays progress and results of tests in text form"""
@@ -2172,6 +2179,7 @@
               list_only=False,
               random_seed=None,
               exclude_pattern=None,
+              strict=False,
               ):
     TestCase._gather_lsprof_in_benchmarks = lsprof_timed
     if verbose:
@@ -2210,6 +2218,10 @@
             suite = filter_suite_by_re(suite, pattern, exclude_pattern,
                 random_order)
     result = runner.run(suite)
+
+    if strict:
+        return result.wasStrictlySuccessful()
+
     return result.wasSuccessful()
 
 
@@ -2221,7 +2233,9 @@
              matching_tests_first=None,
              list_only=False,
              random_seed=None,
-             exclude_pattern=None):
+             exclude_pattern=None,
+             strict=False,
+             ):
     """Run the whole test suite under the enhanced runner"""
     # XXX: Very ugly way to do this...
     # Disable warning about old formats because we don't want it to disturb
@@ -2247,7 +2261,8 @@
                      matching_tests_first=matching_tests_first,
                      list_only=list_only,
                      random_seed=random_seed,
-                     exclude_pattern=exclude_pattern)
+                     exclude_pattern=exclude_pattern,
+                     strict=strict)
     finally:
         default_transport = old_transport
 

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2007-07-11 01:44:46 +0000
+++ b/bzrlib/tests/test_selftest.py	2007-07-31 10:33:33 +0000
@@ -990,6 +990,29 @@
         # and not count as an error
         self.assertEqual(0, result.error_count)
 
+    def test_strict_with_unsupported_feature(self):
+        result = bzrlib.tests.TextTestResult(self._log_file, descriptions=0,
+                                                verbosity=1)
+        test = self.get_passing_test()
+        feature = "Unsupported Feature"
+        result.addNotSupported(test, feature)
+        self.assertFalse(result.wasStrictlySuccessful())
+
+    def test_strict_with_known_failure(self):
+        result = bzrlib.tests.TextTestResult(self._log_file, descriptions=0,
+                                                verbosity=1)
+        test = self.get_passing_test()
+        err = (KnownFailure, KnownFailure('foo'), None)
+        result.addKnownFailure(test, err)
+        self.assertFalse(result.wasStrictlySuccessful())
+
+    def test_strict_with_success(self):
+        result = bzrlib.tests.TextTestResult(self._log_file, descriptions=0,
+                                                verbosity=1)
+        test = self.get_passing_test()
+        result.addSuccess(test)
+        self.assertTrue(result.wasStrictlySuccessful())
+
 
 class TestRunner(TestCase):
 

=== modified file 'doc/developers/HACKING.txt'
--- a/doc/developers/HACKING.txt	2007-08-07 17:35:24 +0000
+++ b/doc/developers/HACKING.txt	2007-08-09 05:56:20 +0000
@@ -261,6 +261,12 @@
 
   ./bzr selftest -v -x blackbox  
 
+To ensure that all tests are being run and succeeding, you can use the
+--strict option which will fail if there are any missing features or known
+failures, like so::
+
+  ./bzr selftest --strict
+
 To list tests without running them, use the --list-only option like so::
 
   ./bzr selftest --list-only




More information about the bazaar-commits mailing list