[issue15007] Unittest CLI does not support test packages very well

R. David Murray report at bugs.python.org
Wed Jun 6 03:15:36 CEST 2012

R. David Murray <rdmurray at bitdance.com> added the comment:

Right, I'm not wanting to run discovery from the command line, I'm wanting to run the tests in the package by package name.  In my mind, this is exactly parallel to specifying a module name and having unittest automatically discover the TestCase classes in it.  We don't have unittest run 0 tests because discovery wasn't invoked when the module name was specified.  Why should it be different for a test package?  If boilerplate is required in __init__.py to make that happen that's OK, though to my mind not ideal.

Is there some different magic I can put into __init__.py that will result in the tests in the package being run such that the package name shows up in the report?  Without that, specifying a package name on the unittest command line seems pretty useless.  (I mean, to get it to do anything useful, you'd have to be putting all the TestCases in the __init__.py, and if you are doing that, why have a package?)

The issue about improving the name output was about making it copy and pasteable (something I would also very much like).  The naming issue here is different, about how to get the package name to show up in the fully qualified test name.

I will open another bug for the _top_level_dir issue.


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list