From 2a23adf4405bcd903aabf445dd54867d95f494a1 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 6 Sep 2015 14:13:25 +0300 Subject: Use support.change_cwd() in tests. --- Lib/test/test_py_compile.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Lib/test/test_py_compile.py') diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index 1abea278a2..c1fd4f60da 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -63,11 +63,9 @@ class PyCompileTests(unittest.TestCase): self.assertTrue(os.path.exists(self.cache_path)) def test_cwd(self): - cwd = os.getcwd() - os.chdir(self.directory) - py_compile.compile(os.path.basename(self.source_path), - os.path.basename(self.pyc_path)) - os.chdir(cwd) + with support.change_cwd(self.directory): + py_compile.compile(os.path.basename(self.source_path), + os.path.basename(self.pyc_path)) self.assertTrue(os.path.exists(self.pyc_path)) self.assertFalse(os.path.exists(self.cache_path)) -- cgit v1.2.1