3 from nose.plugins.doctests import Doctest
4 from nose.plugins import PluginTester
6 support = os.path.join(os.path.dirname(__file__), 'support')
8 class TestDoctestPlugin(PluginTester, unittest.TestCase):
9 activate = '--with-doctest'
12 suitepath = os.path.join(support, 'dtt')
15 print str(self.output)
17 assert 'Doctest: some_mod ... ok' in self.output
18 assert 'Doctest: some_mod.foo ... ok' in self.output
19 assert 'Ran 2 tests' in self.output
20 assert str(self.output).strip().endswith('OK')
23 class TestDoctestFiles(PluginTester, unittest.TestCase):
24 activate = '--with-doctest'
25 args = ['-v', '--doctest-extension=.txt']
27 suitepath = os.path.join(support, 'dtt', 'docs')
30 print str(self.output)
33 'Doctest: doc.txt ... ok',
34 'Doctest: errdoc.txt ... FAIL'
36 for line in self.output:
39 if line.startswith('='):
41 self.assertEqual(line.strip(), expect.pop(0))
43 if __name__ == '__main__':