Comment 2 for bug 395362

Revision history for this message
Xavier Gnata (xavier-gnata-gmail) wrote : Re: [Bug 395362] Re: unittest is broken

> *** This bug is a duplicate of bug 389942 ***
> https://bugs.launchpad.net/bugs/389942
>
> Hi Xavier,
>
> As you note in your bug description, there is already a bug filed for
> this issue. Therefore, I'm marking this bug as a duplicate, and will
> open a python2.6 task on the parent bug.
>
> I will not open a python-defaults task on the parent bug because I see
> no reason why python-defaults is involved.
>
> ** This bug has been marked a duplicate of bug 389942
> python-nose is broken in Karmic alpha 2
>
>

Hi,

Well the point is that python2.6.2.tgz from python.org do not show this
patch on Lib/unittest.py. It reads:
def __init__(self, module='__main__', defaultTest=None,
                 argv=None, testRunner=TextTestRunner,
                 testLoader=defaultTestLoader):
        if type(module) == type(''):
            self.module = __import__(module)
            for part in module.split('.')[1:]:
                self.module = getattr(self.module, part)

Why is unittest.py patched by python2.6_2.6.2-0ubuntu2.diff this way?:

+--- Lib/unittest.py (.../tags/r262) (Revision 73476)
++++ Lib/unittest.py (.../branches/release26-maint) (Revision 73476)
+@@ -798,8 +798,10 @@
+ in MyTestCase
+ """
+ def __init__(self, module='__main__', defaultTest=None,
+- argv=None, testRunner=TextTestRunner,
++ argv=None, testRunner=None,
+ testLoader=defaultTestLoader):
++ if testRunner is None:
++ testRunner = TextTestRunner
+ if type(module) == type(''):
+ self.module = __import__(module)
+ for part in module.split('.')[1:]:

unittest.py comes from python2.6 that is why I have opened this bug
(but maybe it is not good practice. Please tell me).

Will this patch on unittest.py part of python2.6.3 ?
Should python-nose try to accomadate with this patch ?

Xavier