]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#9964: fix running test_cmd_line_script under -O and -OO.
authorGeorg Brandl <georg@python.org>
Thu, 14 Oct 2010 08:08:56 +0000 (08:08 +0000)
committerGeorg Brandl <georg@python.org>
Thu, 14 Oct 2010 08:08:56 +0000 (08:08 +0000)
Lib/test/test_cmd_line_script.py

index 75e9f8da46bc4df8dc5ae6b0ef8b1eb75210038c..bd34392163c66522e0b0797a667b37d5b2e81e90 100644 (file)
@@ -1,6 +1,7 @@
 # tests command line execution of scripts
 
 import unittest
+import sys
 import os
 import os.path
 import py_compile
@@ -97,6 +98,8 @@ class CmdLineTest(unittest.TestCase):
                             expected_argv0, expected_path0,
                             expected_package,
                             *cmd_line_switches):
+        if not __debug__:
+            cmd_line_switches += ('-' + 'O' * sys.flags.optimize,)
         run_args = cmd_line_switches + (script_name,)
         rc, out, err = assert_python_ok(*run_args)
         self._check_output(script_name, rc, out + err, expected_file,