Removed doctest test, explained how to replace its functionality with nose's in the docs.

This commit is contained in:
Ryan Williams
2009-10-04 12:01:15 -07:00
parent 5bc7e88083
commit 0214ce1d00
2 changed files with 10 additions and 32 deletions

View File

@@ -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
----------------------

View File

@@ -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)