Ronald Oussoren added the comment: That's correct, I have a test like:
def test_something(self): for info in CASES: with self.subTest(info): self.assert_something(info) For some values of 'info' the test is known to fail and I want to mark those as exptectedFailure somehow and there doesn't appear to be a way to do so right now. I'm currently doing: with self.subTest(info): try: ... # actual test except: if info in KNOWN_FAILURES: self.skipTest() raise That suppresses the test failures, but in an unclean way and without getting a warning when the testcase starts working again. I could generate testcases manually the old fashioned way without using subTest, but that results in more complicated test code and requires rewriting a number of tests. One possible design for making it possible to mark subTests as known failures it to return a value in the subTest context manager that has a method for marking the subTest: with self.subTest(...) as tc: if ...: tc.expectedFailure(...) ... # actual test I don't know how invasive such a change would be. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30997> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com