mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-40527: Fix command line argument parsing (GH-19955)
This commit is contained in:
parent
eff870b618
commit
2668a9a5aa
3 changed files with 29 additions and 7 deletions
|
@ -756,6 +756,17 @@ class CmdLineTest(unittest.TestCase):
|
|||
self.assertEqual(proc.returncode, 0, proc)
|
||||
self.assertEqual(proc.stdout.strip(), b'0')
|
||||
|
||||
def test_parsing_error(self):
|
||||
args = [sys.executable, '-I', '--unknown-option']
|
||||
proc = subprocess.run(args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True)
|
||||
err_msg = "unknown option --unknown-option\nusage: "
|
||||
self.assertTrue(proc.stderr.startswith(err_msg), proc.stderr)
|
||||
self.assertNotEqual(proc.returncode, 0)
|
||||
|
||||
|
||||
@unittest.skipIf(interpreter_requires_environment(),
|
||||
'Cannot run -I tests when PYTHON env vars are required.')
|
||||
class IgnoreEnvironmentTest(unittest.TestCase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue