diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-14 21:49:12 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-14 21:49:12 -0500 |
commit | 9c3d6750cbef8e0673e4123aa39149e28a8a098e (patch) | |
tree | bd59ae58528124ada6513ee459dde1d8f8c87339 /setuptools/tests | |
parent | 9948d3c8a7880cbc13012e8a3fedda130614601d (diff) | |
download | external_python_setuptools-9c3d6750cbef8e0673e4123aa39149e28a8a098e.tar.gz external_python_setuptools-9c3d6750cbef8e0673e4123aa39149e28a8a098e.tar.bz2 external_python_setuptools-9c3d6750cbef8e0673e4123aa39149e28a8a098e.zip |
Add test capturing failure when the Exception is not pickleable. Ref #329.
Diffstat (limited to 'setuptools/tests')
-rw-r--r-- | setuptools/tests/test_sandbox.py | 12 |
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',)" |