diff options
| author | Barry Warsaw | 2008-01-01 13:49:27 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2008-01-01 13:49:27 -0500 |
| commit | adae635a4ca147937019fdd91aebd95a2769b9ca (patch) | |
| tree | 7cdae81b4b7715781e889f32bbd0dbba80609367 /Mailman/tests/test_documentation.py | |
| parent | 5b4bb22feca4d520afef44d1c472807e020d17b5 (diff) | |
| download | mailman-adae635a4ca147937019fdd91aebd95a2769b9ca.tar.gz mailman-adae635a4ca147937019fdd91aebd95a2769b9ca.tar.zst mailman-adae635a4ca147937019fdd91aebd95a2769b9ca.zip | |
Extended test_documentation.py to be able to find doctests in subdirectories
called 'docs' anywhere under the Mailman package. Change the rule API to
return rule classes not instances. Added the ChainJump enum, though this will
likely change soon.
Diffstat (limited to 'Mailman/tests/test_documentation.py')
| -rw-r--r-- | Mailman/tests/test_documentation.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Mailman/tests/test_documentation.py b/Mailman/tests/test_documentation.py index 36b3c7ecb..9faf1d588 100644 --- a/Mailman/tests/test_documentation.py +++ b/Mailman/tests/test_documentation.py @@ -31,6 +31,7 @@ from Mailman.app.styles import style_manager from Mailman.configuration import config +DOT = '.' COMMASPACE = ', ' @@ -78,7 +79,12 @@ def cleaning_teardown(testobj): def test_suite(): suite = unittest.TestSuite() - docsdir = os.path.join(os.path.dirname(Mailman.__file__), 'docs') + topdir = os.path.dirname(Mailman.__file__) + packages = [] + for dirpath, dirnames, filenames in os.walk(topdir): + if 'docs' in dirnames: + docsdir = os.path.join(dirpath, 'docs')[len(topdir)+1:] + packages.append(docsdir) # Under higher verbosity settings, report all doctest errors, not just the # first one. flags = (doctest.ELLIPSIS | @@ -86,13 +92,15 @@ def test_suite(): doctest.REPORT_NDIFF) if config.opts.verbosity <= 2: flags |= doctest.REPORT_ONLY_FIRST_FAILURE - for filename in os.listdir(docsdir): - if os.path.splitext(filename)[1] == '.txt': - test = doctest.DocFileSuite( - 'docs/' + filename, - package=Mailman, - optionflags=flags, - setUp=setup, - tearDown=cleaning_teardown) - suite.addTest(test) + # Add all the doctests in all subpackages. + for docsdir in packages: + for filename in os.listdir(os.path.join('Mailman', docsdir)): + if os.path.splitext(filename)[1] == '.txt': + test = doctest.DocFileSuite( + os.path.join(docsdir, filename), + package='Mailman', + optionflags=flags, + setUp=setup, + tearDown=cleaning_teardown) + suite.addTest(test) return suite |
