[pypy-svn] rev 2563 - in pypy/trunk/src/pypy/tool: . testdata
sschwarzer at codespeak.net
sschwarzer at codespeak.net
Fri Dec 19 14:28:11 CET 2003
Author: sschwarzer
Date: Fri Dec 19 14:28:10 2003
New Revision: 2563
Modified:
pypy/trunk/src/pypy/tool/newtest.py
pypy/trunk/src/pypy/tool/testdata/test_dummy.py
Log:
Added method skip to TestCase class.
When setting do_selftest in function main is true, execute _only_ the
selftest.
Modified: pypy/trunk/src/pypy/tool/newtest.py
==============================================================================
--- pypy/trunk/src/pypy/tool/newtest.py (original)
+++ pypy/trunk/src/pypy/tool/newtest.py Fri Dec 19 14:28:10 2003
@@ -43,6 +43,10 @@
"Hook method for deconstructing the test fixture after testing it."
pass
+ def skip(self, msg=None):
+ """Skip this test by raising exception Skipped."""
+ raise Skipped(msg=msg)
+
def fail(self, msg=None):
"""Fail immediately, with the given message."""
raise Failure(msg=msg)
@@ -411,14 +415,13 @@
def main(do_selftest=False):
# possibly ignore dummy unit tests
if do_selftest:
- filterfunc = lambda m: True
+ filterfunc = lambda m: m.find("pypy.tool.testdata.") != -1
else:
filterfunc = lambda m: m.find("pypy.tool.testdata.") == -1
# collect tests
ts = TestSuite()
print "Loading test modules ..."
- #ts.initfromdir(autopath.pypydir, filterfunc=filterfunc)
- ts.initfromdir('.', filterfunc=filterfunc)
+ ts.initfromdir(autopath.pypydir, filterfunc=filterfunc)
# iterate over tests and collect data
for res in ts.result_generator():
if res.traceback is None:
Modified: pypy/trunk/src/pypy/tool/testdata/test_dummy.py
==============================================================================
--- pypy/trunk/src/pypy/tool/testdata/test_dummy.py (original)
+++ pypy/trunk/src/pypy/tool/testdata/test_dummy.py Fri Dec 19 14:28:10 2003
@@ -25,7 +25,7 @@
class TestSkip1(newtest.TestCase):
def setUp(self):
- raise newtest.Skipped
+ self.skip()
def test_skip1(self):
pass
@@ -33,4 +33,4 @@
class TestSkip2(newtest.TestCase):
def test_skip2(self):
- raise newtest.Skipped
+ self.skip()
More information about the Pypy-commit
mailing list