Hello, as explained in (of ) you can actually call a single test, or a single TestClass: $ ./python -m unittest test.test_httpservers.BaseHTTPServerTestCase.test_handler . ---------------------------------------------------------------------- Ran 1 test in 0.168s OK $ ./python -m unittest test.test_httpservers.BaseHTTPServerTestCase .............. ---------------------------------------------------------------------- Ran 14 tests in 1.132s OK I'm closing this report, but feel free to reopen it if you think I'm missing something. Thanks, Sandro
Yes. You're missing the second case. In: > regrtest [options] test_file.test_method You don't specify class name. This saves some time you need to navigate and copy/paste name of container class. It will save more time if masks are used by default. To illustrate this let's introduce '-l' key that lists all found tests to test test discovery (no errors in this sentence). > regrtest -l *des* test_file.FancyRenameTests.test_no_*des*t_exists test_file.FancyRenameTests.test_*des*t_exists test_file.FancyRenameTests.test_*des*t_opened test_file.GitFile*des*tTests.test_invalid test_file.GitFile*des*tTests.test_readonly test_*des*t.SomeClass.some_test .... *stars* in results highlight matched substring. Rationale: The most common operation when looking for tests to run is grep. You don't need to remember option name to specify mask - just use mask - it will run discovery and execute only tests found. '-l' key in test runner can be used to quickly grep available tests to find the exact name and run only it.
I'm -1 on your second case. That syntax is too magical, especially since a test method can appear on more than one test case. The additional pattern matching suggestion is more interesting, but it would be necessary to implement that in unittest, since test classes and methods can be created on the fly. I suggest opening a new issue against unittest to extend pattern matching to test case and test method names if you think that feature is valuable enough to add. I agree with Sandro, I think the valid part of this request is satisfied by the unittest CLI. It is true that more work needs to be done before all Python tests can be run successfully in this fashion, since some depend on regrtest features. But making those fixes (moving useful regrtest features to unittest and eliminating the non-useful regrtest dependencies) is a better investment of resources than adding run-single-test support directly to regrtest, IMO. If you want to submit a patch for first case, though, feel free to reopen this. I doubt we'd reject it if you want to do the work.
History
Date
User
Action
Args
2022-04-11 14:56:59
admin
set
github: 52579
2010-11-13 03:50:20
r.david.murray
set
status: open -> closedversions: + Python 3.2, - Python 2.7nosy: + r.david.murraymessages: + resolution: fixed -> works for mestage: resolved
2010-11-12 17:25:32
techtonik
set
status: closed -> openmessages: +
2010-10-28 19:19:23
sandro.tosi
set
status: open -> closednosy: + sandro.tosimessages: + resolution: fixed