diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-02 11:47:54 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-02 11:47:54 -0500 |
commit | b96f9cd4b2832c4b70b23473dfed1e6f291dd119 (patch) | |
tree | a6cc6b11fba22340e0994c6ea653e985e53469ba /setuptools/tests/test_sandbox.py | |
parent | 4837776968b41fd22d74e560f07e554fcff47d72 (diff) | |
download | external_python_setuptools-b96f9cd4b2832c4b70b23473dfed1e6f291dd119.tar.gz external_python_setuptools-b96f9cd4b2832c4b70b23473dfed1e6f291dd119.tar.bz2 external_python_setuptools-b96f9cd4b2832c4b70b23473dfed1e6f291dd119.zip |
Minor cleanup
Diffstat (limited to 'setuptools/tests/test_sandbox.py')
-rw-r--r-- | setuptools/tests/test_sandbox.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 426c5614..d09d164f 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -1,6 +1,5 @@ """develop tests """ -import sys import os import shutil import tempfile @@ -25,15 +24,13 @@ class TestSandbox: sandbox = DirectorySandbox(self.dir) sandbox.run(self._file_writer(os.devnull)) + @staticmethod def _file_writer(path): def do_write(): - f = open(path, 'w') - f.write('xxx') - f.close() + with open(path, 'w') as f: + f.write('xxx') return do_write - _file_writer = staticmethod(_file_writer) - def test_win32com(self): """ win32com should not be prevented from caching COM interfaces @@ -49,7 +46,8 @@ class TestSandbox: except SandboxViolation: self.fail("Could not create gen_py file due to SandboxViolation") finally: - if os.path.exists(target): os.remove(target) + if os.path.exists(target): + os.remove(target) def test_setup_py_with_BOM(self): """ |