Skip to content

Commit 530f874

Browse files
committed
Add test for timeouterror regression. Ref #85.
1 parent 9c8f2ca commit 530f874

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/test_pickle_exception.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,23 @@ def test_real_oserror():
386386
assert str_output == str(exc)
387387

388388

389+
def test_timeouterror():
390+
try:
391+
raise TimeoutError('stuff')
392+
except Exception as e:
393+
exc = e
394+
else:
395+
pytest.fail('os.open should have raised an TimeoutError')
396+
397+
str_output = str(exc)
398+
tblib.pickling_support.install(exc)
399+
exc = pickle.loads(pickle.dumps(exc))
400+
401+
assert isinstance(exc, TimeoutError)
402+
assert exc.errno is None
403+
assert str_output == str(exc)
404+
405+
389406
@pytest.mark.skipif(not has_python311, reason='ExceptionGroup needs Python 3.11')
390407
def test_exception_group():
391408
errors = []

0 commit comments

Comments
 (0)