Rev 5925: Add a failing test. in file:///home/vila/src/bzr/bugs/746991-selftest-exclude-ored/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri May 27 13:49:19 UTC 2011
At file:///home/vila/src/bzr/bugs/746991-selftest-exclude-ored/
------------------------------------------------------------
revno: 5925
revision-id: v.ladeuil+lp at free.fr-20110527134919-50ib2jcwlg5fn62t
parent: pqm at pqm.ubuntu.com-20110527090129-l9la6zh0v1jp4238
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 746991-selftest-exclude-ored
timestamp: Fri 2011-05-27 15:49:19 +0200
message:
Add a failing test.
-------------- next part --------------
=== 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')
More information about the bazaar-commits
mailing list