aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_sandbox.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-12-13 10:45:04 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-12-13 10:45:04 -0500
commitbf8331685d1d5bb88cc6cf09236601f0dbe62330 (patch)
treea70caf103e63a2ab4b150a80dec6327cb2c9ccf3 /setuptools/tests/test_sandbox.py
parenta627cf9a72f8fca78b0520b72a5b44a0bbea9b8c (diff)
downloadexternal_python_setuptools-bf8331685d1d5bb88cc6cf09236601f0dbe62330.tar.gz
external_python_setuptools-bf8331685d1d5bb88cc6cf09236601f0dbe62330.tar.bz2
external_python_setuptools-bf8331685d1d5bb88cc6cf09236601f0dbe62330.zip
Refine test to not make additional references to exceptions in setuptools.sandbox, but instead create a bespoke unpickleable exception. Ref #440.
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()'