diff Lib/test/test_cmd_line_script.py @ 65300:660afdaeb2d6

#9964: fix running test_cmd_line_script under -O and -OO.
author Georg Brandl <georg@python.org>
date Thu, 14 Oct 2010 08:08:56 +0000
parents b1fb0539bf98
children 0505eba62347
line wrap: on
line diff
--- a/Lib/test/test_cmd_line_script.py	Thu Oct 14 07:42:27 2010 +0000
+++ b/Lib/test/test_cmd_line_script.py	Thu Oct 14 08:08:56 2010 +0000
@@ -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 @@
                             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,