3560
3561
def test_mutiple_excludes(self):
3561
3562
self.assertTestList(['c'], '-x', 'a', '-x', 'b')
3565
class TestCounterHooks(tests.TestCase, SelfTestHelper):
3567
_test_needs_features = [features.subunit]
3570
super(TestCounterHooks, self).setUp()
3571
class Test(tests.TestCase):
3574
super(Test, self).setUp()
3575
self.hooks = hooks.Hooks()
3576
self.hooks.add_hook('myhook', 'Foo bar blah', (2,4))
3577
self.install_counter_hook(self.hooks, 'myhook')
3582
def run_hook_once(self):
3583
for hook in self.hooks['myhook']:
3586
self.test_class = Test
3588
def assertHookCalls(self, expected_calls, test_name):
3589
test = self.test_class(test_name)
3590
result = unittest.TestResult()
3592
self.assertTrue(hasattr(test, '_counters'))
3593
self.assertTrue(test._counters.has_key('myhook'))
3594
self.assertEquals(expected_calls, test._counters['myhook'])
3596
def test_no_hook(self):
3597
self.assertHookCalls(0, 'no_hook')
3599
def test_run_hook_once(self):
3600
tt = features.testtools
3601
if tt.module.__version__ < (0, 9, 8):
3602
raise tests.TestSkipped('testtools-0.9.8 required for addDetail')
3603
self.assertHookCalls(1, 'run_hook_once')