summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-11-03 10:50:01 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-11-03 10:50:01 (GMT)
commit683b46aa8df73c41ccafdfe5909a466c1616cc20 (patch)
treebd9daa653fc28b6316c5ab8c35153aa6dd578ab1
parent47395617bc2a6d2188039bf30e637bc203f93aba (diff)
downloadcpython-683b46aa8df73c41ccafdfe5909a466c1616cc20.zip
cpython-683b46aa8df73c41ccafdfe5909a466c1616cc20.tar.gz
cpython-683b46aa8df73c41ccafdfe5909a466c1616cc20.tar.bz2
Issue #16218: Fix broken test for supporting nonascii characters in python launcher
-rw-r--r--Lib/test/test_cmd_line_script.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index 6e097e3..6dca6f0 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -366,11 +366,18 @@ class CmdLineTest(unittest.TestCase):
def test_non_utf8(self):
# Issue #16218
with temp_dir() as script_dir:
- script_name = _make_test_script(script_dir,
- '\udcf1\udcea\udcf0\udce8\udcef\udcf2')
- self._check_script(script_name, script_name, script_name,
- script_dir, None,
- importlib.machinery.SourceFileLoader)
+ script_basename = '\udcf1\udcea\udcf0\udce8\udcef\udcf2'
+ source = 'print("test output")\n'
+ script_name = _make_test_script(script_dir, script_basename, source)
+ if not __debug__:
+ run_args = ('-' + 'O' * sys.flags.optimize, script_name)
+ else:
+ run_args = (script_name,)
+ rc, out, _ = assert_python_ok(*run_args)
+ self.assertEqual(0, rc)
+ expected = ("test output" + os.linesep).encode('ascii')
+ self.assertEqual(expected, out)
+
def test_main():
support.run_unittest(CmdLineTest)