This commit is contained in:
holger krekel 2012-09-22 20:26:13 +02:00
commit 754fab9b55
3 changed files with 16 additions and 0 deletions

View File

@ -56,6 +56,8 @@ Changes between 2.2.4 and 2.3.0.dev
- fix issue 188: ensure sys.exc_info is clear on python2 - fix issue 188: ensure sys.exc_info is clear on python2
before calling into a test before calling into a test
- fix issue 191: addd unittest TestCase runTest method support
- reporting refinements: - reporting refinements:
- pytest_report_header now receives a "startdir" so that - pytest_report_header now receives a "startdir" so that

View File

@ -34,6 +34,9 @@ class UnitTestCase(pytest.Class):
pytest.mark.xfail(reason=str(funcobj.todo))(funcobj) pytest.mark.xfail(reason=str(funcobj.todo))(funcobj)
yield TestCaseFunction(name, parent=self) yield TestCaseFunction(name, parent=self)
if getattr(self.obj, 'runTest', None) is not None:
yield TestCaseFunction('runTest', parent=self)
def setup(self): def setup(self):
meth = getattr(self.obj, 'setUpClass', None) meth = getattr(self.obj, 'setUpClass', None)
if meth is not None: if meth is not None:

View File

@ -14,6 +14,17 @@ def test_simple_unittest(testdir):
assert reprec.matchreport("testpassing").passed assert reprec.matchreport("testpassing").passed
assert reprec.matchreport("test_failing").failed assert reprec.matchreport("test_failing").failed
def test_runTest_method(testdir):
testpath=testdir.makepyfile("""
import unittest
pytest_plugins = "pytest_unittest"
class MyTestCase(unittest.TestCase):
def runTest(self):
self.assertEquals('foo', 'foo')
""")
reprec = testdir.inline_run(testpath)
assert reprec.matchreport('runTest').passed
def test_isclasscheck_issue53(testdir): def test_isclasscheck_issue53(testdir):
testpath = testdir.makepyfile(""" testpath = testdir.makepyfile("""
import unittest import unittest