Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unittest.TestLoader.loadTestsFromNames should accept module / class name #50239

Closed
voidspace opened this issue May 10, 2009 · 2 comments
Closed
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@voidspace
Copy link
Contributor

BPO 5989
Nosy @voidspace

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/voidspace'
closed_at = <Date 2009-05-10.23:08:15.042>
created_at = <Date 2009-05-10.20:04:19.097>
labels = ['type-feature', 'library']
title = 'unittest.TestLoader.loadTestsFromNames should accept module / class name'
updated_at = <Date 2009-05-10.23:08:15.040>
user = 'https://github.com/voidspace'

bugs.python.org fields:

activity = <Date 2009-05-10.23:08:15.040>
actor = 'michael.foord'
assignee = 'michael.foord'
closed = True
closed_date = <Date 2009-05-10.23:08:15.042>
closer = 'michael.foord'
components = ['Library (Lib)']
creation = <Date 2009-05-10.20:04:19.097>
creator = 'michael.foord'
dependencies = []
files = []
hgrepos = []
issue_num = 5989
keywords = []
message_count = 2.0
messages = ['87540', '87555']
nosy_count = 1.0
nosy_names = ['michael.foord']
pr_nums = []
priority = 'normal'
resolution = 'works for me'
stage = None
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue5989'
versions = ['Python 2.7', 'Python 3.2']

@voidspace
Copy link
Contributor Author

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.

@voidspace voidspace self-assigned this May 10, 2009
@voidspace voidspace added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels May 10, 2009
@voidspace
Copy link
Contributor Author

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. :-)

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant