Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(162293)

Delta Between Two Patch Sets: Lib/test/test_cmd_line.py

Issue 18338: python --version should send output to STDOUT
Left Patch Set: Created 6 years, 5 months ago
Right Patch Set: Created 6 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | Modules/main.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Tests invocation of the interpreter with various command line arguments 1 # Tests invocation of the interpreter with various command line arguments
2 # Most tests are executed with environment variables ignored 2 # Most tests are executed with environment variables ignored
3 # See test_cmd_line_script.py for testing of script execution 3 # See test_cmd_line_script.py for testing of script execution
4 4
5 import test.support, unittest 5 import test.support, unittest
6 import os 6 import os
7 import sys 7 import sys
8 import subprocess 8 import subprocess
9 import tempfile 9 import tempfile
10 from test.script_helper import (spawn_python, kill_python, assert_python_ok, 10 from test.script_helper import (spawn_python, kill_python, assert_python_ok,
(...skipping 22 matching lines...) Expand all
33 self.verify_valid_flag('-OO') 33 self.verify_valid_flag('-OO')
34 34
35 def test_site_flag(self): 35 def test_site_flag(self):
36 self.verify_valid_flag('-S') 36 self.verify_valid_flag('-S')
37 37
38 def test_usage(self): 38 def test_usage(self):
39 rc, out, err = assert_python_ok('-h') 39 rc, out, err = assert_python_ok('-h')
40 self.assertIn(b'usage', out) 40 self.assertIn(b'usage', out)
41 41
42 def test_version(self): 42 def test_version(self):
43 version = ('Python %d.%d' % sys.version_info[:2]).encode('ascii') 43 version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii")
storchaka 2013/07/03 12:37:02 This is unrelated change.
44 for cmd in ('-V', '--version'): 44 rc, out, err = assert_python_ok('-V')
45 output = assert_python_ok(cmd)[1] 45 self.assertFalse(err.startswith(version))
46 self.assertTrue(output.startswith(version)) 46 self.assertTrue(out.startswith(version))
47 47
48 def test_verbose(self): 48 def test_verbose(self):
49 # -v causes imports to write to stderr. If the write to 49 # -v causes imports to write to stderr. If the write to
50 # stderr itself causes an import to happen (for the output 50 # stderr itself causes an import to happen (for the output
51 # codec), a recursion loop can occur. 51 # codec), a recursion loop can occur.
52 rc, out, err = assert_python_ok('-v') 52 rc, out, err = assert_python_ok('-v')
53 self.assertNotIn(b'stack overflow', err) 53 self.assertNotIn(b'stack overflow', err)
54 rc, out, err = assert_python_ok('-vv') 54 rc, out, err = assert_python_ok('-vv')
55 self.assertNotIn(b'stack overflow', err) 55 self.assertNotIn(b'stack overflow', err)
56 56
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 self.assertEqual(err.splitlines().count(b'Unknown option: -a'), 1) 437 self.assertEqual(err.splitlines().count(b'Unknown option: -a'), 1)
438 self.assertEqual(b'', out) 438 self.assertEqual(b'', out)
439 439
440 440
441 def test_main(): 441 def test_main():
442 test.support.run_unittest(CmdLineTest) 442 test.support.run_unittest(CmdLineTest)
443 test.support.reap_children() 443 test.support.reap_children()
444 444
445 if __name__ == "__main__": 445 if __name__ == "__main__":
446 test_main() 446 test_main()
LEFTRIGHT
« no previous file | Modules/main.c » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+