Commit 8d3ed396 authored by Jason R. Coombs's avatar Jason R. Coombs

Just use class in its namespace

parent 20567bef
...@@ -7,12 +7,11 @@ import pytest ...@@ -7,12 +7,11 @@ import pytest
import pkg_resources import pkg_resources
import setuptools.sandbox import setuptools.sandbox
from setuptools.sandbox import DirectorySandbox
class TestSandbox: class TestSandbox:
def test_devnull(self, tmpdir): def test_devnull(self, tmpdir):
with DirectorySandbox(str(tmpdir)): with setuptools.sandbox.DirectorySandbox(str(tmpdir)):
self._file_writer(os.devnull) self._file_writer(os.devnull)
@staticmethod @staticmethod
...@@ -116,11 +115,11 @@ class TestExceptionSaver: ...@@ -116,11 +115,11 @@ class TestExceptionSaver:
with open('/etc/foo', 'w'): with open('/etc/foo', 'w'):
pass pass
sandbox = DirectorySandbox(str(tmpdir))
with pytest.raises(setuptools.sandbox.SandboxViolation) as caught: with pytest.raises(setuptools.sandbox.SandboxViolation) as caught:
with setuptools.sandbox.save_modules(): with setuptools.sandbox.save_modules():
setuptools.sandbox.hide_setuptools() setuptools.sandbox.hide_setuptools()
sandbox.run(write_file) with setuptools.sandbox.DirectorySandbox(str(tmpdir)):
write_file()
cmd, args, kwargs = caught.value.args cmd, args, kwargs = caught.value.args
assert cmd == 'open' assert cmd == 'open'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment