3522
3522
self.assertDocTestStringFails(doctest.DocTestSuite, test)
3523
3523
# tests.DocTestSuite sees None
3524
3524
self.assertDocTestStringSucceds(tests.IsolatedDocTestSuite, test)
3527
class TestSelftestExcludePatterns(tests.TestCase):
3530
super(TestSelftestExcludePatterns, self).setUp()
3531
self.overrideAttr(tests, 'test_suite', self.suite_factory)
3533
def suite_factory(self, keep_only=None, starting_with=None):
3534
"""A test suite factory with only a few tests."""
3535
class Test(tests.TestCase):
3537
# We don't need the full class path
3538
return self._testMethodName
3545
return TestUtil.TestSuite([Test("a"), Test("b"), Test("c")])
3547
def assertTestList(self, expected, *selftest_args):
3548
# We rely on setUp installing the right test suite factory so we can
3549
# test at the command level without loading the whole test suite
3550
out, err = self.run_bzr(('selftest', '--list') + selftest_args)
3551
actual = out.splitlines()
3552
self.assertEquals(expected, actual)
3554
def test_full_list(self):
3555
self.assertTestList(['a', 'b', 'c'])
3557
def test_single_exclude(self):
3558
self.assertTestList(['b', 'c'], '-x', 'a')
3560
def test_mutiple_excludes(self):
3561
self.assertTestList(['c'], '-x', 'a', '-x', 'b')