Export to GitHub

unittest-ext - issue #68

unittest2's loadTestFromName() can't load test cases derived from unittest.TestCase


Posted on Nov 18, 2011 by Quick Hippo

I tried to use unittest2's defaultTestLoader.loadTestsFromNames() to load a specific test from a test case derived from the standard Python 2.6 unittest.TestCase. It would not be recongized.

The attached patch fixes the problem.

Attachments

Comment #1

Posted on Nov 18, 2011 by Helpful Monkey

sigh I think you're correct. Thanks for the report and the fix.

Comment #2

Posted on May 20, 2013 by Massive Wombat

We're hitting this problem in Django as well, FWIW; we've applied this patch to our bundled unittest2, but it still breaks if the user has installed unittest2 from PyPI (as we privilege the version from PyPI over our bundled version).

Comment #3

Posted on May 20, 2013 by Massive Wombat

The Django ticket tracking this is https://code.djangoproject.com/ticket/20437

Comment #4

Posted on Aug 9, 2013 by Helpful Monkey

I'm planning a new release with a couple of bugfixes including this one.

Comment #5

Posted on Nov 4, 2014 by Quick Bird

So, need to fix this upstream ideally to make backports easier.

Comment #6

Posted on Nov 4, 2014 by Helpful Monkey

I think this is a unittest2 specific issue. unittest2 needs to check for subclasses of unittest.TestCase, not just TestCase (which will mean unittest2.TestCase).

Status: Accepted

Labels:
Type-Defect Priority-Medium