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 | 5e6b8ed2cbddcc3603b52ca5e0dd0cc02d62839c (patch) | |
tree | e37ff60282c8b786dbb72c83f69f16b5ec9b2836 | |
parent | f9d72118b7e63fd29238f882f155600fd673427f (diff) | |
download | python-setuptools-bitbucket-5e6b8ed2cbddcc3603b52ca5e0dd0cc02d62839c.tar.gz |
Add test capturing failure when the Exception is not pickleable. Ref #329.
-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',)" |