Terry J. Reedy <tjre...@udel.edu> added the comment:
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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue25172> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com