[Python-checkins] commit of r41542 - python/branches/release24-maint/Lib/test

walter.doerwald@python.org walter.doerwald at python.org
Fri Nov 25 18:02:08 CET 2005


Author: walter.doerwald
Date: Fri Nov 25 18:02:02 2005
New Revision: 41542
Modified:
 python/branches/release24-maint/Lib/test/test_cmd_line.py
Log:
Backport checkin:
SF patch #1364545: test_cmd_line.py relied on english error messages when
invoking the Python interpreter (which didn't work on non-english Windows
versions). Check return codes instead.
Modified: python/branches/release24-maint/Lib/test/test_cmd_line.py
==============================================================================
--- python/branches/release24-maint/Lib/test/test_cmd_line.py	(original)
+++ python/branches/release24-maint/Lib/test/test_cmd_line.py	Fri Nov 25 18:02:02 2005
@@ -2,6 +2,7 @@
 import test.test_support, unittest
 import sys
 import popen2
+import subprocess
 
 class CmdLineTest(unittest.TestCase):
 def start_python(self, cmd_line):
@@ -11,9 +12,18 @@
 outfp.close()
 return data
 
+ def exit_code(self, cmd_line):
+ return subprocess.call([sys.executable, cmd_line], stderr=subprocess.PIPE)
+
 def test_directories(self):
- self.assertTrue('is a directory' in self.start_python('.'))
- self.assertTrue('is a directory' in self.start_python('< .'))
+ if sys.platform == 'win32':
+ # Exit code for "python .", Error 13: permission denied = 2
+ expected_exit_code = 2
+ else:
+ # Linux has no problem with "python .", Exit code = 0
+ expected_exit_code = 0
+ self.assertEqual(self.exit_code('.'), expected_exit_code)
+ self.assertTrue(self.exit_code('< .') != 0)
 
 def verify_valid_flag(self, cmd_line):
 data = self.start_python(cmd_line)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /