Rev 5930: (vila) Support multiple selftest --exclude options (Vincent Ladeuil) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri May 27 19:13:42 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5930 [merge]
revision-id: pqm at pqm.ubuntu.com-20110527191338-i1gu6p7xrmagd2l7
parent: pqm at pqm.ubuntu.com-20110527171203-s50ymd0mviaw4c7k
parent: v.ladeuil+lp at free.fr-20110527175723-vvm07ydeccenexg9
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-05-27 19:13:38 +0000
message:
(vila) Support multiple selftest --exclude options (Vincent Ladeuil)
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
doc/en/whats-new/whats-new-in-2.4.txt whatsnewin2.4.txt-20110114044330-nipk1og7j729fy89-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2011-05-27 11:05:47 +0000
+++ b/bzrlib/builtins.py 2011-05-27 17:57:23 +0000
@@ -3691,10 +3691,10 @@
Option('randomize', type=str, argname="SEED",
help='Randomize the order of tests using the given'
' seed or "now" for the current time.'),
- Option('exclude', type=str, argname="PATTERN",
- short_name='x',
- help='Exclude tests that match this regular'
- ' expression.'),
+ ListOption('exclude', type=str, argname="PATTERN",
+ short_name='x',
+ help='Exclude tests that match this regular'
+ ' expression.'),
Option('subunit',
help='Output test progress via subunit.'),
Option('strict', help='Fail on missing dependencies or '
@@ -3751,6 +3751,10 @@
"--benchmark is no longer supported from bzr 2.2; "
"use bzr-usertest instead")
test_suite_factory = None
+ if not exclude:
+ exclude_pattern = None
+ else:
+ exclude_pattern = '(' + '|'.join(exclude) + ')'
selftest_kwargs = {"verbose": verbose,
"pattern": pattern,
"stop_on_failure": one,
@@ -3761,7 +3765,7 @@
"matching_tests_first": first,
"list_only": list_only,
"random_seed": randomize,
- "exclude_pattern": exclude,
+ "exclude_pattern": exclude_pattern,
"strict": strict,
"load_list": load_list,
"debug_flags": debugflag,
=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py 2011-05-26 08:05:45 +0000
+++ b/bzrlib/tests/test_selftest.py 2011-05-27 13:49:19 +0000
@@ -3522,3 +3522,40 @@
self.assertDocTestStringFails(doctest.DocTestSuite, test)
# tests.DocTestSuite sees None
self.assertDocTestStringSucceds(tests.IsolatedDocTestSuite, test)
+
+
+class TestSelftestExcludePatterns(tests.TestCase):
+
+ def setUp(self):
+ super(TestSelftestExcludePatterns, self).setUp()
+ self.overrideAttr(tests, 'test_suite', self.suite_factory)
+
+ def suite_factory(self, keep_only=None, starting_with=None):
+ """A test suite factory with only a few tests."""
+ class Test(tests.TestCase):
+ def id(self):
+ # We don't need the full class path
+ return self._testMethodName
+ def a(self):
+ pass
+ def b(self):
+ pass
+ def c(self):
+ pass
+ return TestUtil.TestSuite([Test("a"), Test("b"), Test("c")])
+
+ def assertTestList(self, expected, *selftest_args):
+ # We rely on setUp installing the right test suite factory so we can
+ # test at the command level without loading the whole test suite
+ out, err = self.run_bzr(('selftest', '--list') + selftest_args)
+ actual = out.splitlines()
+ self.assertEquals(expected, actual)
+
+ def test_full_list(self):
+ self.assertTestList(['a', 'b', 'c'])
+
+ def test_single_exclude(self):
+ self.assertTestList(['b', 'c'], '-x', 'a')
+
+ def test_mutiple_excludes(self):
+ self.assertTestList(['c'], '-x', 'a', '-x', 'b')
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-05-27 17:12:03 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-05-27 17:57:23 +0000
@@ -84,6 +84,8 @@
the default OS buffer size for pipes is small or the ``python -v``
output is large. (Andrew Bennetts, #784802)
+* Multiple ``selftest --exclude`` options are now combined instead of
+ overriding each other. (Vincent Ladeuil, #746991)
bzr 2.4b3
#########
=== modified file 'doc/en/whats-new/whats-new-in-2.4.txt'
--- a/doc/en/whats-new/whats-new-in-2.4.txt 2011-05-17 14:42:13 +0000
+++ b/doc/en/whats-new/whats-new-in-2.4.txt 2011-05-27 15:02:17 +0000
@@ -101,6 +101,13 @@
network roundtrips. Other operations where a local branch is stacked on a
branch hosted on a smart server will also benefit.
+Testing
+*******
+
+The ``selftest --exclude`` option can now be specified multiple times and
+the tests that match any of the specified patterns will be excluded. Only
+the last specified patetrn was previously taken into account.
+
Further information
*******************
More information about the bazaar-commits
mailing list