This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unittest.TestLoader.loadTestsFromNames should accept module / class name
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: michael.foord
Priority: normal Keywords:

Created on 2009-05-10 20:04 by michael.foord, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg87540 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-05-10 20:04
It would be really nice if unittest.TestLoader.loadTestsFromNames
accepted module and class names.

My main motivation for that is so that I can do:

    python -m unittest module_name

There is no backwards compatibility issue as currently this doesn't work...

Really easy to add.
msg87555 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-05-10 23:08
Actually they do - it is an obscure bug in the way the module is
specified in TestProgram that prevents this from working.

The code in parseArgs that is currently:

            if len(args) > 0:
                self.testNames = args

Should probably be:

            if len(args) > 0:
                self.testNames = args
                self.module = None

Anyway - I'll report and fix that as a separate issue. :-)
History
Date User Action Args
2022-04-11 14:56:48adminsetgithub: 50239
2009-05-10 23:08:15michael.foordsetstatus: open -> closed
resolution: works for me
messages: + msg87555
2009-05-10 20:04:19michael.foordcreate