mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-45445: Fail if an invalid X-option is provided in the command line (GH-28823)
This commit is contained in:
parent
1c83135381
commit
db2b6a20cd
8 changed files with 88 additions and 27 deletions
|
@ -83,8 +83,17 @@ class CmdLineTest(unittest.TestCase):
|
|||
opts = get_xoptions()
|
||||
self.assertEqual(opts, {})
|
||||
|
||||
opts = get_xoptions('-Xa', '-Xb=c,d=e')
|
||||
self.assertEqual(opts, {'a': True, 'b': 'c,d=e'})
|
||||
opts = get_xoptions('-Xno_debug_ranges', '-Xdev=1234')
|
||||
self.assertEqual(opts, {'no_debug_ranges': True, 'dev': '1234'})
|
||||
|
||||
@unittest.skipIf(interpreter_requires_environment(),
|
||||
'Cannot run -E tests when PYTHON env vars are required.')
|
||||
def test_unknown_xoptions(self):
|
||||
rc, out, err = assert_python_failure('-X', 'blech')
|
||||
self.assertIn(b'Unknown value for option -X', err)
|
||||
msg = b'Fatal Python error: Unknown value for option -X'
|
||||
self.assertEqual(err.splitlines().count(msg), 1)
|
||||
self.assertEqual(b'', out)
|
||||
|
||||
def test_showrefcount(self):
|
||||
def run_python(*args):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue