Changeset 53896 in webkit
- Timestamp:
- Jan 26, 2010 9:26:07 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r53895 r53896 1 2010-01-26 Daniel Bates <dbates@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 https://bugs.webkit.org/show_bug.cgi?id=34070 6 7 Moves the try/catch for OSError exceptions in Executive.run_command 8 to Credentials.read_credentials() so that the unit test 9 webkitpy.scm_unittest.SCMClassTests.test_error_handlers can 10 assert that Executive.run_command throws an OSError exception. 11 12 * Scripts/webkitpy/credentials.py: 13 * Scripts/webkitpy/executive.py: Moved try/catch for OSError to 14 method Credentials.read_credentials(). 15 * Scripts/webkitpy/executive_unittest.py: Removed tests that no longer 16 apply: test_run_command_with_bad_command_check_return_code and 17 test_run_command_with_bad_command_check_calls_error_handler. Added new 18 test to assert that run_command throws OSError exceptions. 19 1 20 2010-01-26 Diego Gonzalez <diego.gonzalez@openbossa.org> 2 21 -
trunk/WebKitTools/Scripts/webkitpy/credentials.py
r53776 r53896 112 112 password = None 113 113 114 if Git.in_working_directory(self.cwd): 115 (username, password) = self._credentials_from_git() 114 try: 115 if Git.in_working_directory(self.cwd): 116 (username, password) = self._credentials_from_git() 117 except OSError, e: 118 # Catch and ignore OSError exceptions such as "no such file 119 # or directory" (OSError errno 2), which imply that the Git 120 # command cannot be found/is not installed. 121 pass 116 122 117 123 if not username or not password: -
trunk/WebKitTools/Scripts/webkitpy/executive.py
r53777 r53896 153 153 else: 154 154 stderr = None 155 try: 156 process = subprocess.Popen(args, 157 stdin=stdin, 158 stdout=subprocess.PIPE, 159 stderr=stderr, 160 cwd=cwd) 161 output = process.communicate(string_to_communicate)[0] 162 exit_code = process.wait() 163 except OSError, e: 164 # Catch OSError exceptions. For example, "no such file or 165 # directory" (i.e. OSError errno 2), when the command cannot be 166 # found. 167 output = e.strerror 168 exit_code = e.errno 155 156 process = subprocess.Popen(args, 157 stdin=stdin, 158 stdout=subprocess.PIPE, 159 stderr=stderr, 160 cwd=cwd) 161 output = process.communicate(string_to_communicate)[0] 162 exit_code = process.wait() 169 163 if exit_code: 170 164 script_error = ScriptError(script_args=args, -
trunk/WebKitTools/Scripts/webkitpy/executive_unittest.py
r52703 r53896 29 29 30 30 import unittest 31 from webkitpy.executive import Executive, ScriptError,run_command31 from webkitpy.executive import Executive, run_command 32 32 33 33 class ExecutiveTest(unittest.TestCase): 34 34 35 def test_run_command_with_bad_command_check_return_code(self): 36 self.assertEqual(run_command(["foo_bar_command_blah"], error_handler=Executive.ignore_error, return_exit_code=True), 2) 37 38 def test_run_command_with_bad_command_check_calls_error_handler(self): 39 self.didHandleErrorGetCalled = False 40 def handleError(scriptError): 41 self.didHandleErrorGetCalled = True 42 self.assertEqual(scriptError.exit_code, 2) 43 44 run_command(["foo_bar_command_blah"], error_handler=handleError) 45 self.assertTrue(self.didHandleErrorGetCalled) 35 def test_run_command_with_bad_command(self): 36 def run_bad_command(): 37 run_command(["foo_bar_command_blah"], error_handler=Executive.ignore_error, return_exit_code=True) 38 self.failUnlessRaises(OSError, run_bad_command) 46 39 47 40 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.