Skip to content

Commit a57b575

Browse files
pfalconpi-anl
authored andcommitted
unittest: AssertRaisesContext: Store exception value as self.exception.
For tests to check. This feature is used by CPython stdlib tests.
1 parent 965e25c commit a57b575

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

python-stdlib/unittest/unittest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __enter__(self):
2121
return self
2222

2323
def __exit__(self, exc_type, exc_value, tb):
24+
self.exception = exc_value
2425
if exc_type is None:
2526
assert False, "%r not raised" % self.expected
2627
if issubclass(exc_type, self.expected):

0 commit comments

Comments
 (0)