[pypy-commit] pypy py3.3: regrtest.py has changed, and many test modules use the standard unittest
amauryfa
noreply at buildbot.pypy.org
Tue Dec 30 17:22:43 CET 2014
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3.3
Changeset: r75166:bf3f2a3c98f3
Date: 2014-12-30 17:20 +0100
http://bitbucket.org/pypy/pypy/changeset/bf3f2a3c98f3/
Log: regrtest.py has changed, and many test modules use the standard
unittest discovery method. This should get many new failures...
diff --git a/pypy/tool/pytest/run-script/regrverbose.py b/pypy/tool/pytest/run-script/regrverbose.py
--- a/pypy/tool/pytest/run-script/regrverbose.py
+++ b/pypy/tool/pytest/run-script/regrverbose.py
@@ -1,4 +1,4 @@
-# refer to 2.4.1/test/regrtest.py's runtest() for comparison
+# refer to 3/test/regrtest.py's runtest() for comparison
import sys
import unittest
from test import regrtest, support
@@ -10,10 +10,13 @@
try:
regrtest.replace_stdout()
mod = __import__(impname, globals(), locals(), [modname])
- indirect_test = getattr(mod, 'test_main', None)
- if indirect_test is not None:
- indirect_test()
+ # If the test has a test_main, that will run the appropriate
+ # tests. If not, use normal unittest test loading.
+ test_runner = getattr(mod, "test_main", None)
+ if test_runner is None:
+ tests = unittest.TestLoader().loadTestsFromModule(mod)
+ test_runner = lambda: support.run_unittest(tests)
+ test_runner()
except unittest.SkipTest:
sys.stderr.write("="*26 + "skipped" + "="*26 + "\n")
raise
-# else the test already ran during import
More information about the pypy-commit
mailing list