Naitree Zhu <naitr...@gmail.com> added the comment: What would be a good default reason? How about the function name?
if isinstance(reason, types.FunctionType): reason = reason.__name__ For example, from unittest import TestCase, skip class Test(TestCase): @skip def test_bad_skip(self): self.assertFalse(1.0) @skip('always skipped') def test_good_skip(self): self.assertFalse(1.0) $ python -m unittest -v test.py test_bad_skip (test.Test) ... skipped 'test_bad_skip' test_good_skip (test.Test) ... skipped 'always skipped' ---------------------------------------------------------------------- Ran 2 tests in 0.000s OK (skipped=2) But this wouldn't be very helpful if test method is a lambda (just saying...) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34596> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com