From 22b9b379159f953ad4805980644414354030624f Mon Sep 17 00:00:00 2001 From: Meador Inge Date: Mon, 28 Nov 2011 09:27:32 -0600 Subject: Issue #12618: py_compile cannot create files in current directory Initial patch by Sjoerd de Vries. --- Lib/test/test_py_compile.py | 9 +++++++++ 1 file changed, 9 insertions(+) (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 8ad0897433..f3c1a6a44b 100644 --- a/Lib/test/test_py_compile.py +++ b/Lib/test/test_py_compile.py @@ -39,6 +39,15 @@ class PyCompileTests(unittest.TestCase): py_compile.compile(self.source_path) 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) + self.assertTrue(os.path.exists(self.pyc_path)) + self.assertFalse(os.path.exists(self.cache_path)) + def test_relative_path(self): py_compile.compile(os.path.relpath(self.source_path), os.path.relpath(self.pyc_path)) -- cgit v1.2.1