[issue16935] unittest should understand SkipTest at import time during test discovery

Zachary Ware report at bugs.python.org
Mon Jan 28 20:48:07 CET 2013


Zachary Ware added the comment:

Here's a patch that I believe nicely handles the raising of unittest.SkipTest at module level while doing test discovery.  It adds a _make_skipped_test function to unittest.loader, and an ``except case.SkipTest`` clause to TestLoader._find_tests.  For our own test package, this covers non-enabled resources as well.

Here's some example output:
"""
P:\cpython>python -m unittest discover -v Lib/test/ "test_curs*"
test_curses (unittest.loader.ModuleSkipped) ... skipped "Use of the 'curses' res
ource not enabled"

----------------------------------------------------------------------
Ran 1 test in 0.001s

OK (skipped=1)
[102289 refs, 38970 blocks]
"""

----------
keywords: +patch
Added file: http://bugs.python.org/file28884/issue16935.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16935>
_______________________________________


More information about the Python-bugs-list mailing list