diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-21 13:42:28 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-10-21 13:42:28 (GMT) |
commit | 9583cac6337f9a5f2670fbe5e1f2e85aaad04522 (patch) | |
tree | 219c579de12fb04e6239ff11d548bfa454b6f135 /Lib/test | |
parent | 6d61cb4d2fc1cd0b412bdf0cf15337751e56f0d2 (diff) | |
download | cpython-9583cac6337f9a5f2670fbe5e1f2e85aaad04522.zip cpython-9583cac6337f9a5f2670fbe5e1f2e85aaad04522.tar.gz cpython-9583cac6337f9a5f2670fbe5e1f2e85aaad04522.tar.bz2 |
Issue #10089: Add support for arbitrary -X options on the command-line.
They can be retrieved through a new attribute `sys._xoptions`.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_cmd_line.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index c864cdd..0ddc813 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -67,6 +67,15 @@ class CmdLineTest(unittest.TestCase): rc, out, err = assert_python_ok('-vv') 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]) + 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]) + self.assertEqual(opts, {'a': True, 'b': 'c,d=e'}) + def test_run_module(self): # Test expected operation of the '-m' switch # Switch needs an argument |