8000 [3.11] Fix test_py_compile with -O mode (GH-115345) (GH-115670) · python/cpython@55b9633 · GitHub
[go: up one dir, main page]

Skip to content

Commit 55b9633

Browse files
[3.11] Fix test_py_compile with -O mode (GH-115345) (GH-115670)
(cherry picked from commit 07ef9d8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent d491522 commit 55b9633

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_py_compile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ class PyCompileCLITestCase(unittest.TestCase):
227227
def setUp(self):
228228
self.directory = tempfile.mkdtemp()
229229
self.source_path = os.path.join(self.directory, '_test.py')
230-
self.cache_path = importlib.util.cache_from_source(self.source_path)
230+
self.cache_path = importlib.util.cache_from_source(self.source_path,
231+
optimization='' if __debug__ else 1)
231232
with open(self.source_path, 'w') as file:
232233
file.write('x = 123\n')
233234

@@ -249,6 +250,7 @@ def pycompilecmd_failure(self, *args):
249250
return script_helper.assert_python_failure('-m', 'py_compile', *args)
250251

251252
def test_stdin(self):
253+
self.assertFalse(os.path.exists(self.cache_path))
252254
result = self.pycompilecmd('-', input=self.source_path)
253255
self.assertEqual(result.returncode, 0)
254256
self.assertEqual(result.stdout, b'')

0 commit comments

Comments
 (0)
0