diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-06-25 19:54:17 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-06-25 19:54:17 (GMT) |
commit | ef8115e5ebcb316eade7346785eee533b07ef8e5 (patch) | |
tree | 85b8c56690f37e6e0f15dac4cac52c583d3a9a7e /Lib/test/test_cmd_line.py | |
parent | 383a820e0dd05273940c9513be7ee17d912aa54f (diff) | |
download | cpython-ef8115e5ebcb316eade7346785eee533b07ef8e5.zip cpython-ef8115e5ebcb316eade7346785eee533b07ef8e5.tar.gz cpython-ef8115e5ebcb316eade7346785eee533b07ef8e5.tar.bz2 |
Issue #17206: Fix test_cmd_line and test_faulthandler for my previous change
(test.regrtest and test.script_helper enable faulthandler module in
subprocesses).
Diffstat (limited to 'Lib/test/test_cmd_line.py')
-rw-r--r-- | Lib/test/test_cmd_line.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 9ae882f..1270ce3 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -54,12 +54,19 @@ class CmdLineTest(unittest.TestCase): self.assertNotIn(b'stack overflow', err) def test_xoptions(self): - rc, out, err = assert_python_ok('-c', 'import sys; print(sys._xoptions)') - opts = eval(out.splitlines()[0]) + def get_xoptions(*args): + # use subprocess module directly because test.script_helper adds + # "-X faulthandler" to the command line + args = (sys.executable, '-E') + args + args += ('-c', 'import sys; print(sys._xoptions)') + out = subprocess.check_output(args) + opts = eval(out.splitlines()[0]) + return opts + + opts = get_xoptions() self.assertEqual(opts, {}) - rc, out, err = assert_python_ok( - '-Xa', '-Xb=c,d=e', '-c', 'import sys; print(sys._xoptions)') - opts = eval(out.splitlines()[0]) + + opts = get_xoptions('-Xa', '-Xb=c,d=e') self.assertEqual(opts, {'a': True, 'b': 'c,d=e'}) def test_showrefcount(self): |