[Python-checkins] r85465 - python/branches/py3k/Lib/test/test_cmd_line_script.py

georg.brandl python-checkins at python.org
Thu Oct 14 10:08:56 CEST 2010


Author: georg.brandl
Date: Thu Oct 14 10:08:56 2010
New Revision: 85465

Log:
#9964: fix running test_cmd_line_script under -O and -OO.

Modified:
   python/branches/py3k/Lib/test/test_cmd_line_script.py

Modified: python/branches/py3k/Lib/test/test_cmd_line_script.py
==============================================================================
--- python/branches/py3k/Lib/test/test_cmd_line_script.py	(original)
+++ python/branches/py3k/Lib/test/test_cmd_line_script.py	Thu Oct 14 10:08:56 2010
@@ -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,


More information about the Python-checkins mailing list