2 Tests that plugins can override loadTestsFromTestCase
6 from nose import loader
7 from nose.plugins import PluginTester
8 from nose.plugins.base import Plugin
11 support = os.path.join(os.path.dirname(__file__), 'support')
14 class NoFixturePlug(Plugin):
17 def options(self, parser, env):
21 def configure(self, options, conf):
25 def loadTestsFromTestCase(self, testCaseClass):
27 class Derived(testCaseClass):
32 # must use nose loader here because the default loader in 2.3
33 # won't load tests from base classes
34 l = loader.TestLoader()
35 return l.loadTestsFromTestCase(Derived)
38 class TestLoadTestsFromTestCaseHook(PluginTester, unittest.TestCase):
42 plugins = [NoFixturePlug()]
43 suitepath = os.path.join(support, 'ltftc')
47 'test_value (%s.Derived) ... ERROR' % __name__,
48 'test_value (tests.Tests) ... ok']
49 print str(self.output)
50 for line in self.output:
52 self.assertEqual(line.strip(), expect.pop(0))
55 if __name__ == '__main__':