-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_docs.py
35 lines (24 loc) · 833 Bytes
/
test_docs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import manuel.codeblock
import manuel.doctest
import manuel.ignore
import manuel.testing
import unittest
DOCTEST_STREAM = None
def get_manuel_doctest():
global DOCTEST_STREAM
m = manuel.doctest.Manuel()
DOCTEST_STREAM = m.runner._fakeout
return m
def get_test_suite():
m = manuel.ignore.Manuel()
m += get_manuel_doctest()
m += manuel.codeblock.Manuel()
return manuel.testing.TestSuite(m, 'README.rst')
if __name__ == '__main__':
import logging
test_suite = get_test_suite()
# Redirect logging output to doctest runner so we can test logging output.
# See https://stackoverflow.com/a/22301726/260303
logging.basicConfig(level=logging.DEBUG, stream=DOCTEST_STREAM,
format='%(levelname)s: %(message)s')
unittest.TextTestRunner().run(test_suite)