summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_sandbox.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/tests/test_sandbox.py')
-rw-r--r--setuptools/tests/test_sandbox.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py
index 624954df..a54c2fa0 100644
--- a/setuptools/tests/test_sandbox.py
+++ b/setuptools/tests/test_sandbox.py
@@ -106,7 +106,15 @@ class TestExceptionSaver:
As revealed in #440, an infinite recursion can occur if an unpickleable
exception while setuptools is hidden. Ensure this doesn't happen.
"""
- sandbox = setuptools.sandbox
- with sandbox.save_modules():
- sandbox.hide_setuptools()
- raise sandbox.SandboxViolation('test')
+ class ExceptionUnderTest(Exception):
+ """
+ An unpickleable exception (not in globals).
+ """
+
+ 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()'