diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-18 13:55:52 +0200 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-18 13:55:52 +0200 |
commit | 7c66319edcbeb3d1590e1c2397efea3171623be2 (patch) | |
tree | 431564f33e3221e7f491afddc90e215ef4ac132e /Lib/test | |
parent | 6a5fc4c443fb7190f3f68ed1eaa799b71fa36124 (diff) | |
download | cpython-git-7c66319edcbeb3d1590e1c2397efea3171623be2.tar.gz |
#16306: Fix multiple error messages when unknown command line parameters where passed to the interpreter. Patch by Hieu Nguyen.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_cmd_line.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 7d039ee00e..d8f244353c 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -7,7 +7,8 @@ import os import sys import subprocess import tempfile -from test.script_helper import spawn_python, kill_python, assert_python_ok, assert_python_failure +from test.script_helper import (spawn_python, kill_python, assert_python_ok, + assert_python_failure) # XXX (ncoghlan): Move to script_helper and make consistent with run_python @@ -376,6 +377,12 @@ class CmdLineTest(unittest.TestCase): assert_python_ok(filename) + def test_unknown_options(self): + rc, out, err = assert_python_failure('-z', __cleanenv=True) + self.assertIn(b'Unknown option', err) + self.assertEqual(err.splitlines().count(b'Unknown option: -z'), 1) + self.assertEqual(b'', out) + def test_main(): test.support.run_unittest(CmdLineTest) test.support.reap_children() |