[Python-checkins] CVS: python/dist/src/Lib unittest.py,1.7,1.7.2.1
Anthony Baxter
anthonybaxter@users.sourceforge.net
Tue, 04 Dec 2001 22:30:23 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv1241
Modified Files:
Tag: release21-maint
unittest.py
Log Message:
backport 1.8, 1.9
--
patch 418489 from Andrew Dalke for string format bug
--
Merged in bugfix from PyUnit CVS for problem reported by Gary Todd.
If 'unittest.py' was run from the command line with the name of a test
case class as a parameter, it failed with an ugly error. (Which was a
shame, because the documentation says you can do that.)
--
Index: unittest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** unittest.py 2001/04/15 09:18:32 1.7
--- unittest.py 2001/12/05 06:30:21 1.7.2.1
***************
*** 433,439 ****
obj = getattr(obj, part)
if type(obj) == types.ModuleType:
return self.loadTestsFromModule(obj)
! elif type(obj) == types.ClassType and issubclass(obj, TestCase):
return self.loadTestsFromTestCase(obj)
elif type(obj) == types.UnboundMethodType:
--- 433,440 ----
obj = getattr(obj, part)
+ import unittest
if type(obj) == types.ModuleType:
return self.loadTestsFromModule(obj)
! elif type(obj) == types.ClassType and issubclass(obj, unittest.TestCase):
return self.loadTestsFromTestCase(obj)
elif type(obj) == types.UnboundMethodType:
***************
*** 441,448 ****
elif callable(obj):
test = obj()
! if not isinstance(test, TestCase) and \
! not isinstance(test, TestSuite):
raise ValueError, \
! "calling %s returned %s, not a test" % obj,test
return test
else:
--- 442,449 ----
elif callable(obj):
test = obj()
! if not isinstance(test, unittest.TestCase) and \
! not isinstance(test, unittest.TestSuite):
raise ValueError, \
! "calling %s returned %s, not a test" % (obj,test)
return test
else: