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.

Title: `python -m uniittest` should work with file paths as well as test module names
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: eric.araujo, michael.foord
Priority: normal Keywords:

Created on 2010-12-04 00:20 by michael.foord, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg123309 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-12-04 00:20
Feature request against unittest2. Issue 18:

As providing a file path instead of module name to the unittest command line runner currently fails there is no backwards compatibility issue with making this work.

The only potential issue is if a test suite or module is genuinely '' then we could end up attempting to load the file instead of the specified suite / module. To get round this we should only attempt to load tests from a file by checking the file exists first.

The specified still needs to be *imported* to load tests from it, so the file path will be converted to a module name by replacing path separators with '.'.

The way to execute test files that aren't importable as modules is to execute them directly not using `python -m unittest`.
msg123310 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-12-04 01:12
Committed revision 87003.
Date User Action Args
2022-04-11 14:57:09adminsetgithub: 54829
2011-01-03 18:19:56michael.foordsetstatus: open -> closed
2010-12-04 01:12:26michael.foordsetresolution: fixed
messages: + msg123310
stage: resolved
2010-12-04 00:32:18eric.araujosetnosy: + eric.araujo
2010-12-04 00:20:06michael.foordcreate