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.
Created on 2011年05月31日 23:56 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| regrtest_regex.patch | vstinner, 2011年05月31日 23:56 | review | ||
| regrtest_regex-2.patch | vstinner, 2011年07月01日 13:44 | review | ||
| Messages (11) | |||
|---|---|---|---|
| msg137402 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年05月31日 23:56 | |
Attached patch adds -k/--func-regex and -K/--file-regex options to filter tests by function/file names. It modifies makeSuite() and getTestCaseNames() functions of unittest.loader to add an optional filter argument: callback taking a function name as argument and returning False if the test should be ignored. You can use the new options more than once and their argument are regular expressions (case insensitive). Examples: - "./python -m test -k subprocess -K pass_fds" runs only 1 function of 1 file: test_subprocess.test_pass_fds() - "./python -m test -k os$" runs 1 file: test_os - "./python -m test -K codecencoding" runs 6 files: test_codecencodings_cn, test_codecencodings_hk, test_codecencodings_iso2022, test_codecencodings_jp, test_codecencodings_kr, test_codecencodings_tw |
|||
| msg137405 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年06月01日 00:11 | |
> Attached patch adds -k/--func-regex and -K/--file-regex options to filter > tests by function/file names. We need maybe a third option to filter tests by their class name. And we need also maybe the opposite option: exclude tests matching a regex. Another proposition: --include and --exclude options using the following format: <file regex>:<class regex>:<function regex> Each field is optional, examples: --include "test_subprocess::leak" ignores test_leak function of test_subprocess file --include "codecencoding::" runs the 6 test_codecencoding* files --include "test_subprocess:^C:" runs only the tests of the io module (not the _pyio module) - etc. Problem: --exclude (-x) option is already used. |
|||
| msg137429 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2011年06月01日 11:15 | |
IMHO it would be better to tweak regrtest so that it understand test_file.TestClass.test_method, possibly supporting wildcards. E.g.: - ./python -m test test_subprocess.POSIXProcessTestCase - ./python -m test test_subprocess.POSIXProcessTestCase.test_pass_fds - ./python -m test '*codecencoding*' - ./python -m test 'test_subprocess.C*' The -x/--exclude option could be extended to support this notation too and make possible to exclude specific tests classes/methods. Wildcards are less flexible than regex, but I think they are good enough for our use case and simpler to use. |
|||
| msg137433 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2011年06月01日 14:11 | |
+1 to what Ezio said, though I'd rather have this than not have the functionality at all :) |
|||
| msg137525 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月03日 15:34 | |
How about reusing unittest discovery in regrtest? |
|||
| msg137589 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年06月03日 21:13 | |
> How about reusing unittest discovery in regrtest? Does this feature support filtering by keyword for file names and function names? |
|||
| msg137640 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月04日 14:39 | |
File name, class name, method name unless I misremember. |
|||
| msg139581 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年07月01日 13:44 | |
regrtest_regex-2.patch: minor update, just ensure that the patch applies correctly on the default branch. |
|||
| msg141032 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2011年07月24日 01:46 | |
See also #12626 for a similar suggestion. |
|||
| msg141130 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年07月25日 23:33 | |
This patch doesn't work if run_unittest() is called with an already constructed test suite or test case (the patch in #12626 does). |
|||
| msg149781 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年12月18日 16:42 | |
Already fixed in #12626. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:18 | admin | set | github: 56440 |
| 2011年12月18日 16:42:09 | pitrou | set | status: open -> closed resolution: duplicate messages: + msg149781 superseder: run test cases based on a glob filter stage: needs patch -> resolved |
| 2011年07月25日 23:33:59 | pitrou | set | nosy:
+ pitrou messages: + msg141130 |
| 2011年07月24日 01:46:01 | ezio.melotti | set | messages: + msg141032 |
| 2011年07月01日 13:44:19 | vstinner | set | files:
+ regrtest_regex-2.patch messages: + msg139581 |
| 2011年06月04日 14:39:19 | eric.araujo | set | messages: + msg137640 |
| 2011年06月03日 21:13:36 | vstinner | set | messages: + msg137589 |
| 2011年06月03日 15:34:25 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg137525 |
| 2011年06月01日 14:11:55 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg137433 |
| 2011年06月01日 11:15:50 | ezio.melotti | set | versions:
- Python 3.1, Python 2.7, Python 3.2 nosy: + ezio.melotti messages: + msg137429 type: enhancement stage: needs patch |
| 2011年06月01日 00:11:39 | vstinner | set | messages: + msg137405 |
| 2011年06月01日 00:05:43 | Arfrever | set | nosy:
+ Arfrever |
| 2011年05月31日 23:56:12 | vstinner | create | |