[Python-Dev] unittest bug (original) (raw)
Ethan Furman ethan at stoneleaf.us
Thu Aug 4 01:00:52 CEST 2011
- Previous message: [Python-Dev] unittest bug
- Next message: [Python-Dev] Daily reference leaks (65c412586901): sum=0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Michael Foord wrote:
On 3 Aug 2011, at 22:58, Ethan Furman wrote:
Michael Foord wrote:
On 3 Aug 2011, at 21:36, Ethan Furman wrote:
My apologies for posting here first, but I'm not yet confident enough in my bug searching fu, and duplicates are a pain.
Here's the issue: from unittest import *
That's the bug right there. Just import TestCase and main and everything should work fine. Using "import *" is not recommended except at the interactive interpreter and it doesn't play well with unittest.main which does magic introspection to find tests to run.
If from xxx import * is not supported, why provide all? a) to define the public API
In trying to refute this, I found http://docs.python.org/py3k/reference/simple_stmts.html?highlight=all#the-import-statement and learned something new. Thanks, Michael!
I think I'll withdraw my bug report, however -- since
from ... import *
is already noted as usually bad practice it should
fall on the shoulders of the modules where it is /supposed/ to work to
advertise that, and absent any such advertisement it should not be used.
Ethan
- Previous message: [Python-Dev] unittest bug
- Next message: [Python-Dev] Daily reference leaks (65c412586901): sum=0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]