summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-14 21:49:12 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-14 21:49:12 -0500
commit5e6b8ed2cbddcc3603b52ca5e0dd0cc02d62839c (patch)
treee37ff60282c8b786dbb72c83f69f16b5ec9b2836
parentf9d72118b7e63fd29238f882f155600fd673427f (diff)
downloadpython-setuptools-bitbucket-5e6b8ed2cbddcc3603b52ca5e0dd0cc02d62839c.tar.gz
Add test capturing failure when the Exception is not pickleable. Ref #329.
-rw-r--r--setuptools/tests/test_sandbox.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py
index 1340cecf..6e1e9e1c 100644
--- a/setuptools/tests/test_sandbox.py
+++ b/setuptools/tests/test_sandbox.py
@@ -88,3 +88,15 @@ class TestExceptionSaver:
pass
saved_exc.resume()
+
+ def test_unpickleable_exception(self):
+ class CantPickleThis(Exception):
+ "This Exception is unpickleable because it's not in globals"
+
+ with setuptools.sandbox.ExceptionSaver() as saved_exc:
+ raise CantPickleThis('detail')
+
+ with pytest.raises(setuptools.sandbox.UnpickleableException) as caught:
+ saved_exc.resume()
+
+ assert str(caught.value) == "CantPickleThis('detail',)"