[svn r58284] make sure that "test" prefix is enough.

--HG--
branch : trunk
This commit is contained in:
hpk 2008-09-21 08:40:54 +02:00
parent 94f1abbbb0
commit ad89dfc565
3 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,6 @@
import py import py
import unittest import unittest
import sys import sys
from py.__.test.collect import configproperty as _configproperty
unittest.failureException = AssertionError unittest.failureException = AssertionError
def configproperty(name): def configproperty(name):
@ -13,7 +12,7 @@ def configproperty(name):
class Module(py.test.collect.Module): class Module(py.test.collect.Module):
UnitTestCase = configproperty('UnitTestCase') UnitTestCase = configproperty('UnitTestCase')
def makeitem(self, name, obj, usefilters=True): def makeitem(self, name, obj, usefilters=True):
# XXX add test_suite() support(?) # XXX add generic test_suite() support(?)
if py.std.inspect.isclass(obj) and issubclass(obj, unittest.TestCase): if py.std.inspect.isclass(obj) and issubclass(obj, unittest.TestCase):
return self.UnitTestCase(name, parent=self) return self.UnitTestCase(name, parent=self)
elif callable(obj) and getattr(obj, 'func_name', '') == 'test_suite': elif callable(obj) and getattr(obj, 'func_name', '') == 'test_suite':

View File

@ -1,4 +1,5 @@
code for collecting traditional unit tests based on code for collecting traditional unit tests.
This conftest is based on
http://johnnydebris.net/svn/projects/py_unittest http://johnnydebris.net/svn/projects/py_unittest

View File

@ -13,11 +13,11 @@ class TestTestCaseInstance(suptest.InlineSession):
test_one = self.makepyfile(test_one=""" test_one = self.makepyfile(test_one="""
import unittest import unittest
class MyTestCase(unittest.TestCase): class MyTestCase(unittest.TestCase):
def test_passing(self): def testpassing(self):
self.assertEquals('foo', 'foo') self.assertEquals('foo', 'foo')
""") """)
sorter = self.parse_and_run(test_one) sorter = self.parse_and_run(test_one)
rep = sorter.getreport("test_passing") rep = sorter.getreport("testpassing")
assert rep.passed assert rep.passed
def test_simple_failing(self): def test_simple_failing(self):