yunojuno / django-juno-testrunner

A more useful (and slightly more glamorous) test runner for Django 1.6+ from the folks at YunoJuno
MIT License
7 stars 9 forks source link

Circumvent invalid test names caused by import errors #18

Closed gergelypolonkai closed 8 years ago

gergelypolonkai commented 8 years ago

Possible fix for #1

Signed-off-by: Gergely Polonkai gergely@polonkai.eu

stevejalim commented 8 years ago

Makes sense - thanks @gergelypolonkai.

Any chance you can add a test, to protect against regressions if, say, unittest changes its exception path or name?

gergelypolonkai commented 8 years ago

How about this?

if name.startswith('unittest.loader.'):
    name = '.'.join(name.split('.')[3:])

This won’t work if the exception gets higher or deeper in the module hierarchy, though…

gergelypolonkai commented 8 years ago

We can be pretty sure the unittest. part will be the same forever(ish), but the remaining parts of the path seems almost undetectable to me. But if you have any ideas, I’m willing to implement it.

gergelypolonkai commented 8 years ago

I didn’t intend to close this, as the solution didn’t get merged. Or did it?

stevejalim commented 8 years ago

I don't think this has been merged yet, no - I can't reopen as it wasn't my PR

gergelypolonkai commented 8 years ago

Me neither, as it says “There are no new commits on the gergelypolonkai:master branch”. Reopened it as #23.