summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line_script.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-14 08:08:56 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-14 08:08:56 (GMT)
commitf5247e35c186e4325c95e28554412f040aa5114f (patch)
treec0c658f1543a70c4cd81c14888e33d9e2cd17a75 /Lib/test/test_cmd_line_script.py
parent1463a3f8334b3279587af84d1134c559105f366a (diff)
downloadcpython-f5247e35c186e4325c95e28554412f040aa5114f.zip
cpython-f5247e35c186e4325c95e28554412f040aa5114f.tar.gz
cpython-f5247e35c186e4325c95e28554412f040aa5114f.tar.bz2
#9964: fix running test_cmd_line_script under -O and -OO.
Diffstat (limited to 'Lib/test/test_cmd_line_script.py')
-rw-r--r--Lib/test/test_cmd_line_script.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index 75e9f8d..bd34392 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -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,