Message415645
In an attempt to replicate Terry's usage, I added the following patch:
```
diff --git a/Lib/idlelib/idle_test/test_text.py b/Lib/idlelib/idle_test/test_text.py
index 0f31179e04..be977bbfff 100644
--- a/Lib/idlelib/idle_test/test_text.py
+++ b/Lib/idlelib/idle_test/test_text.py
@@ -20,6 +20,10 @@ def test_init(self):
self.assertEqual(self.text.get('end'), '')
def test_index_empty(self):
+ """
+ Failing test with bad description.
+ """
+ raise ValueError()
index = self.text.index
for dex in (-1.0, 0.3, '1.-1', '1.0', '1.0 lineend', '1.end', '1.33',
```
When I did, I then ran the tests using the `-m` launcher:
```
$ ./python.exe -m test.test_idle -v -k test_index_empty
idlelib.idle_test.test_configdialog (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_debugger (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_editmenu (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_help (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_parenmatch (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_percolator (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_replace (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_scrolledlist (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_search (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
test_index_empty (idlelib.idle_test.test_text.MockTextTest)
Failing test with bad description. ... ERROR
setUpClass (idlelib.idle_test.test_text.TkTextTest) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_textview (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_tooltip (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_tree (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
idlelib.idle_test.test_undo (unittest.loader.ModuleSkipped) ... skipped 'cannot run without OS X gui process'
======================================================================
ERROR: test_index_empty (idlelib.idle_test.test_text.MockTextTest)
Failing test with bad description.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/jaraco/code/public/cpython/Lib/idlelib/idle_test/test_text.py", line 26, in test_index_empty
raise ValueError()
^^^^^^^^^^^^^^^^^^
ValueError
----------------------------------------------------------------------
Ran 14 tests in 0.001s
FAILED (errors=1, skipped=14)
```
As you can see, the location of the failing test in the log is masked, and instead the description is present.
I've pushed https://github.com/python/cpython/tree/bpo-46126/disable-descriptions-unittest-m, which when applied disables the descriptions.
This approach works as a surgical intervention, wrapping `unittest.main` in such a way that it could be replaced across the test suite to disable descriptions. By subclassing the TextTestRunner, it continues to honor other parameters from the command-line (such as verbosity).
Terry, would you review the concept? Does it meet your needs? If so, I can apply it more broadly and prepare a PR. |
|
Date |
User |
Action |
Args |
2022-03-21 00:42:30 | jaraco | set | recipients:
+ jaraco, terry.reedy, eric.araujo, ethan.furman, miss-islington |
2022-03-21 00:42:30 | jaraco | set | messageid: <1647823350.86.0.187670232238.issue46126@roundup.psfhosted.org> |
2022-03-21 00:42:30 | jaraco | link | issue46126 messages |
2022-03-21 00:42:30 | jaraco | create | |
|