[pypy-svn] pypy default: add some docs about the new --filter and --pdb options
antocuni
commits-noreply at bitbucket.org
Tue Jan 18 16:35:21 CET 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r40876:7c76152c98a7
Date: 2011-01-18 16:32 +0100
http://bitbucket.org/pypy/pypy/changeset/7c76152c98a7/
Log: add some docs about the new --filter and --pdb options
diff --git a/lib-python/modified-2.7.0/test/test_support.py b/lib-python/modified-2.7.0/test/test_support.py
--- a/lib-python/modified-2.7.0/test/test_support.py
+++ b/lib-python/modified-2.7.0/test/test_support.py
@@ -1052,6 +1052,11 @@
guards, default = _parse_guards(guards)
return guards.get(platform.python_implementation().lower(), default)
+# ----------------------------------
+# PyPy extension: you can run::
+# python ..../test_foo.py --pdb
+# to get a pdb prompt in case of exceptions
+
class TestResultWithPdb(unittest.result.TestResult):
def addError(self, testcase, exc_info):
@@ -1061,6 +1066,8 @@
traceback.print_tb(exc_info[2])
pdb.post_mortem(exc_info[2], pdb.Pdb)
+# ----------------------------------
+
def _run_suite(suite):
"""Run tests from a unittest.TestSuite-derived class."""
if verbose:
@@ -1082,6 +1089,11 @@
err += "; run in verbose mode for details"
raise TestFailed(err)
+# ----------------------------------
+# PyPy extension: you can run::
+# python ..../test_foo.py --filter bar
+# to run only the test cases whose name contains bar
+
def filter_maybe(suite):
try:
i = sys.argv.index('--filter')
@@ -1104,6 +1116,8 @@
for item in linearize_suite(subsuite):
yield item
+# ----------------------------------
+
def run_unittest(*classes):
"""Run tests from unittest.TestCase-derived classes."""
valid_types = (unittest.TestSuite, unittest.TestCase)
More information about the Pypy-commit
mailing list