Commit bf833168 authored by Jason R. Coombs's avatar Jason R. Coombs

Refine test to not make additional references to exceptions in...

Refine test to not make additional references to exceptions in setuptools.sandbox, but instead create a bespoke unpickleable exception. Ref #440.
parent a627cf9a
...@@ -106,7 +106,15 @@ class TestExceptionSaver: ...@@ -106,7 +106,15 @@ class TestExceptionSaver:
As revealed in #440, an infinite recursion can occur if an unpickleable As revealed in #440, an infinite recursion can occur if an unpickleable
exception while setuptools is hidden. Ensure this doesn't happen. exception while setuptools is hidden. Ensure this doesn't happen.
""" """
sandbox = setuptools.sandbox class ExceptionUnderTest(Exception):
with sandbox.save_modules(): """
sandbox.hide_setuptools() An unpickleable exception (not in globals).
raise sandbox.SandboxViolation('test') """
with pytest.raises(setuptools.sandbox.UnpickleableException) as exc:
with setuptools.sandbox.save_modules():
setuptools.sandbox.hide_setuptools()
raise ExceptionUnderTest()
msg, = exc.value.args
assert msg == 'ExceptionUnderTest()'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment