diff options
Diffstat (limited to 'Lib/test/test_py_compile.py')
-rw-r--r-- | Lib/test/test_py_compile.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py index b919da2..5ec523a 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -5,7 +5,7 @@ import shutil import tempfile import unittest -from test import test_support +from test import test_support as support class PyCompileTests(unittest.TestCase): @@ -35,11 +35,9 @@ class PyCompileTests(unittest.TestCase): self.assertTrue(os.path.exists(self.pyc_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)) def test_relative_path(self): @@ -48,7 +46,7 @@ class PyCompileTests(unittest.TestCase): self.assertTrue(os.path.exists(self.pyc_path)) def test_main(): - test_support.run_unittest(PyCompileTests) + support.run_unittest(PyCompileTests) if __name__ == "__main__": test_main() |