homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: fix using unittest as a superclass
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: agoucher, gvanrossum, pitrou
Priority: normal Keywords: patch

Created on 2008年01月28日 14:39 by agoucher, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
cpython-unittest-subclass.diff agoucher, 2008年01月28日 14:39 cpython-unittest-subclass.diff
Messages (3)
msg61776 - (view) Author: Adam Goucher (agoucher) Date: 2008年01月28日 14:39
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
class B(A.A)
 def testFoo(self):
 print "blah blah blah
I have attached a patch which will address all locations where this
could happen.
msg61780 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008年01月28日 15:09
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 ;-)).
msg61782 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008年01月28日 15:57
This patch seems to be based upon a misunderstanding of how Python
namespaces work.
History
Date User Action Args
2022年04月11日 14:56:30adminsetgithub: 46247
2008年01月28日 15:57:32gvanrossumsetstatus: open -> closed
keywords: + patch
resolution: rejected
messages: + msg61782
nosy: + gvanrossum
2008年01月28日 15:10:00pitrousetnosy: + pitrou
messages: + msg61780
2008年01月28日 14:39:33agouchercreate

AltStyle によって変換されたページ (->オリジナル) /