Custom output checker that lets us add: `+EXPECTED_FAILURE` for doctest tests. We want to be able to mark failing doctest test the same way we do with normal unit test, without this class we would have to skip the doctest for the CI to pass.
| 10 | |
| 11 | |
| 12 | class DocTestChecker(doctest.OutputChecker): |
| 13 | """ |
| 14 | Custom output checker that lets us add: `+EXPECTED_FAILURE` for doctest tests. |
| 15 | |
| 16 | We want to be able to mark failing doctest test the same way we do with normal |
| 17 | unit test, without this class we would have to skip the doctest for the CI to pass. |
| 18 | """ |
| 19 | |
| 20 | def check_output(self, want, got, optionflags): |
| 21 | res = super().check_output(want, got, optionflags) |
| 22 | if optionflags & EXPECTED_FAILURE: |
| 23 | res = not res |
| 24 | return res |
no outgoing calls