aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_sandbox.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-05-30 19:39:58 -0400
committerJason R. Coombs <jaraco@jaraco.com>2017-05-30 19:39:58 -0400
commitfcdf12ee7fdf43c9dded5b68232a0fb3376d4858 (patch)
tree29baaad1490dcce705ccc5f32c6d9d9240e1d10d /setuptools/tests/test_sandbox.py
parent3d0cc355fb5e8012cb8c72f0e25042a5a44f31d6 (diff)
parent4dc2c76b62a5071dfacf434555dfa8ec2be0b433 (diff)
downloadexternal_python_setuptools-fcdf12ee7fdf43c9dded5b68232a0fb3376d4858.tar.gz
external_python_setuptools-fcdf12ee7fdf43c9dded5b68232a0fb3376d4858.tar.bz2
external_python_setuptools-fcdf12ee7fdf43c9dded5b68232a0fb3376d4858.zip
Merge branch 'master' into feature/re-vendor-sadface
Diffstat (limited to 'setuptools/tests/test_sandbox.py')
-rw-r--r--setuptools/tests/test_sandbox.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py
index 929f0a5b..a3f1206d 100644
--- a/setuptools/tests/test_sandbox.py
+++ b/setuptools/tests/test_sandbox.py
@@ -7,13 +7,12 @@ import pytest
import pkg_resources
import setuptools.sandbox
-from setuptools.sandbox import DirectorySandbox
class TestSandbox:
def test_devnull(self, tmpdir):
- sandbox = DirectorySandbox(str(tmpdir))
- sandbox.run(self._file_writer(os.devnull))
+ with setuptools.sandbox.DirectorySandbox(str(tmpdir)):
+ self._file_writer(os.devnull)
@staticmethod
def _file_writer(path):
@@ -116,13 +115,17 @@ class TestExceptionSaver:
with open('/etc/foo', 'w'):
pass
- sandbox = DirectorySandbox(str(tmpdir))
with pytest.raises(setuptools.sandbox.SandboxViolation) as caught:
with setuptools.sandbox.save_modules():
setuptools.sandbox.hide_setuptools()
- sandbox.run(write_file)
+ with setuptools.sandbox.DirectorySandbox(str(tmpdir)):
+ write_file()
cmd, args, kwargs = caught.value.args
assert cmd == 'open'
assert args == ('/etc/foo', 'w')
assert kwargs == {}
+
+ msg = str(caught.value)
+ assert 'open' in msg
+ assert "('/etc/foo', 'w')" in msg