New submission from Brett Cannon:
For test discovery to work where a dependent module is optional, you end up
needing to do something like what is done in
http://hg.python.org/cpython/rev/15ddd683c321:
-crypt = support.import_module('crypt')
+def setUpModule():
+ # this import will raise unittest.SkipTest if _crypt doesn't exist,
+ # so it has to be done in setUpModule for test discovery to work
+ global crypt
+ crypt = support.import_module('crypt')
That's kind of ugly. It would be better if unittest recognized SkipTest at
import time during test discovery
----------
assignee: michael.foord
components: Library (Lib)
messages: 179681
nosy: brett.cannon, michael.foord
priority: normal
severity: normal
stage: test needed
status: open
title: unittest should understand SkipTest at import time during test discovery
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16935>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com