You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2008-01-28.15:57:32.018>created_at=<Date2008-01-28.14:39:33.412>labels= ['library']
title='fix using unittest as a superclass'updated_at=<Date2008-01-28.15:57:31.913>user='https://bugs.python.org/agoucher'
There are a couple places in unittest where 'issubclass(something,
TestCase)' is used. This prevents you from organizing your test code via
class hierarchies. To solve this problem, issubclass should be looking
whether the object is a subclass of unittest.TestCase to walk the
inheritance tree all the way up and not just a single level.
Currently, this will not work.
module A..
class A(unittest.TestCase):
pass
module B...
import A
classB(A.A)
deftestFoo(self):
print "blahblahblah
I have attached a patch which will address all locations where this
could happen.
I don't really understand what problem you are trying to solve. Can you
attach a sample script to show it more clearly?
Also, the only thing your patch does is rename Test(Case|Suite)
references to unittest.Test(Case|Suite)... I doubt it would have any
effect unless you were monkeypatching the unittest module to replace
those classes with other ones (which should certainly be considered very
dirty ;-)).
Activity
agoucher commentedon Jan 28, 2008
There are a couple places in unittest where 'issubclass(something,
TestCase)' is used. This prevents you from organizing your test code via
class hierarchies. To solve this problem, issubclass should be looking
whether the object is a subclass of unittest.TestCase to walk the
inheritance tree all the way up and not just a single level.
Currently, this will not work.
module A..
class A(unittest.TestCase):
pass
module B...
import A
I have attached a patch which will address all locations where this
could happen.
pitrou commentedon Jan 28, 2008
I don't really understand what problem you are trying to solve. Can you
attach a sample script to show it more clearly?
Also, the only thing your patch does is rename Test(Case|Suite)
references to unittest.Test(Case|Suite)... I doubt it would have any
effect unless you were monkeypatching the unittest module to replace
those classes with other ones (which should certainly be considered very
dirty ;-)).
gvanrossum commentedon Jan 28, 2008
This patch seems to be based upon a misunderstanding of how Python
namespaces work.