From 6a6a261fa50522d77fba6d6345fb71ba9f00c311 Mon Sep 17 00:00:00 2001 From: Tarek Ziade Date: Thu, 6 May 2010 18:10:32 +0200 Subject: make sure all tests passes on all python versions fixes #149 --HG-- branch : distribute extra : rebase_source : 6288f4fcf65083b9d4ffb0ea8b35af44e699b4d5 --- setuptools/tests/test_sandbox.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'setuptools/tests/test_sandbox.py') diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index 8b9e08e6..1609ee86 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -30,10 +30,11 @@ class TestSandbox(unittest.TestCase): shutil.rmtree(self.dir) def test_devnull(self): + if sys.version < '2.4': + return sandbox = DirectorySandbox(self.dir) sandbox.run(self._file_writer(os.devnull)) - @staticmethod def _file_writer(path): def do_write(): f = open(path, 'w') @@ -41,6 +42,7 @@ class TestSandbox(unittest.TestCase): f.close() return do_write + _file_writer = staticmethod(_file_writer) if has_win32com(): def test_win32com(self): @@ -53,9 +55,10 @@ class TestSandbox(unittest.TestCase): target = os.path.join(gen_py, 'test_write') sandbox = DirectorySandbox(self.dir) try: - sandbox.run(self._file_writer(target)) - except SandboxViolation: - self.fail("Could not create gen_py file due to SandboxViolation") + try: + sandbox.run(self._file_writer(target)) + except SandboxViolation: + self.fail("Could not create gen_py file due to SandboxViolation") finally: if os.path.exists(target): os.remove(target) -- cgit v1.2.3