From 0214ce1d0062d5659a14900496b6af804b4681ed Mon Sep 17 00:00:00 2001 From: Ryan Williams Date: Sun, 4 Oct 2009 12:01:15 -0700 Subject: [PATCH] Removed doctest test, explained how to replace its functionality with nose's in the docs. --- doc/testing.rst | 10 ++++++++++ tests/test__doctests.py | 32 -------------------------------- 2 files changed, 10 insertions(+), 32 deletions(-) delete mode 100644 tests/test__doctests.py diff --git a/doc/testing.rst b/doc/testing.rst index 3ed0f36..40127c1 100644 --- a/doc/testing.rst +++ b/doc/testing.rst @@ -23,6 +23,16 @@ That's it! The output from running nose is the same as unittest's output, if th Many tests are skipped based on environmental factors; for example, it makes no sense to test Twisted-specific functionality when Twisted is not installed. These are printed as S's during execution, and in the summary printed after the tests run it will tell you how many were skipped. +Doctests +-------- + +To run the doctests included in many of the eventlet modules, use this command: + +.. code-block :: sh + + $ nosetests --with-doctest eventlet/*.py + +Currently there are 14 doctests. Standard Library Tests ---------------------- diff --git a/tests/test__doctests.py b/tests/test__doctests.py deleted file mode 100644 index da1102c..0000000 --- a/tests/test__doctests.py +++ /dev/null @@ -1,32 +0,0 @@ -import os -import re -import doctest -import unittest -import eventlet - -base = os.path.dirname(eventlet.__file__) -modules = set() - -for path, dirs, files in os.walk(base): - package = 'eventlet' + path.replace(base, '').replace('/', '.') - modules.add((package, os.path.join(path, '__init__.py'))) - for f in files: - module = None - if f.endswith('.py'): - module = f[:-3] - if module: - modules.add((package + '.' + module, os.path.join(path, f))) - -suite = unittest.TestSuite() -tests_count = 0 -modules_count = 0 -for m, path in modules: - if re.search('^\s*>>> ', open(path).read(), re.M): - s = doctest.DocTestSuite(m) - print '%s (from %s): %s tests' % (m, path, len(s._tests)) - suite.addTest(s) - modules_count += 1 - tests_count += len(s._tests) -print 'Total: %s tests in %s modules' % (tests_count, modules_count) -runner = unittest.TextTestRunner(verbosity=2) -runner.run(suite)