Message349143
I agree with Paul about the wording. Note that the proposed platform-specific catch and raise are for crypt.py, not test_crypt.py.
If a test module should be skipped entirely, import_module is correct. For more refinement, test_idle has, for example,
tk = import_module('tkinter') # Also imports _tkinter.
if tk.TkVersion < 8.5:
raise unittest.SkipTest("IDLE requires tk 8.5 or later.")
Testing only continues if tkinter and _tkinter and tk >= 8.5.
I presume that crypt = import_module('crypt') will only continue if crypt and _crypt, which is what you want. It is apparently not an error for _crypt to be missing on unix, just an inconvenience for people who expect it.
FYI, Individual test classes and methods can be skipped with
@unittest.skipIf(condition, message) # example
@unittest.skipIf(sys.platform != 'darwin', 'test macOS-only code')
See the unittest doc for more, though apparently not needed here. |
|
| Date |
User |
Action |
Args |
| 2019-08-07 00:41:19 | terry.reedy | set | recipients:
+ terry.reedy, paul.moore, jafo, tim.golden, zach.ware, steve.dower, shireenrao |
| 2019-08-07 00:41:19 | terry.reedy | set | messageid: <1565138479.84.0.82637510798.issue25172@roundup.psfhosted.org> |
| 2019-08-07 00:41:19 | terry.reedy | link | issue25172 messages |
| 2019-08-07 00:41:19 | terry.reedy | create | |
|