Issue 7780: unittest: allow an 'import_path' as an alternative to 'top_level_dir' in test discover (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/52028

classification

Title: unittest: allow an 'import_path' as an alternative to 'top_level_dir' in test discover
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.2

process

Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: michael.foord, r.david.murray
Priority: normal Keywords:

Created on 2010-01-25 22:31 by r.david.murray, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg98302 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-01-25 22:31
It would be nice if TestLoader.discover could take an argument that specifies the path to use to import the discovered tests, as an alternative to having to specify top_level_dir.
msg98925 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-02-06 00:31
My suggestion is that test discovery should first try the argument as a directory. If that fails try it as a dotted name by importing it. If the import succeeds discovery can start from the directory containing the imported package. If a module rather than a package is specified as a dotted name argument to test discovery then we can either just run the tests in that module or raise an error?
msg102215 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-04-03 01:17
Committed revision 79643. Needs test and documentation.
msg105288 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-05-08 13:20
Test committed revision 80974.
msg105296 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-05-08 15:12
Documented revision 80980.
History
Date User Action Args
2022-04-11 14:56:56 admin set github: 52028
2010-05-08 15:12:10 michael.foord set status: open -> closedmessages: + stage: resolved
2010-05-08 13:20:45 michael.foord set messages: +
2010-05-08 13:16:28 michael.foord set messages: -
2010-05-08 13:15:35 michael.foord set messages: +
2010-04-03 01:17:25 michael.foord set resolution: acceptedmessages: +
2010-02-06 00:31:24 michael.foord set messages: +
2010-01-25 22:31:27 r.david.murray create