forked from RustPython/RustPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrustpython.py
More file actions
24 lines (17 loc) · 705 Bytes
/
rustpython.py
File metadata and controls
24 lines (17 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
RustPython specific helpers.
"""
import doctest
# copied from https://github.com/RustPython/RustPython/pull/6919
EXPECTED_FAILURE = doctest.register_optionflag("EXPECTED_FAILURE")
class DocTestChecker(doctest.OutputChecker):
"""
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.
"""
def check_output(self, want, got, optionflags):
res = super().check_output(want, got, optionflags)
if optionflags & EXPECTED_FAILURE:
res = not res
return res