AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
xfail isn't just for pytest tests. Python's unittest has @unittest.expectedFailure.
In this episode, we cover:
Docs for expectedFailure:
https://docs.python.org/3/library/unittest.html#skipping-tests-and-expected-failures
Some sample code.
unittest only:
unittest with pytest markers:
import unittest import pytest class ExpectedFailureTestCase(unittest.TestCase): @pytest.mark.xfail def test_fail(self): self.assertEqual(1, 0, "broken") @pytest.mark.xfail def test_pass(self): self.assertEqual(1, 1, "not broken")