[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
dbates at webkit.org
dbates at webkit.org
Thu Feb 4 21:28:54 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 14a03ffbb21b9866127c04c744a79d49d9e15768
Author: dbates at webkit.org <dbates at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 27 05:26:07 2010 +0000
2010-01-26 Daniel Bates <dbates at webkit.org>
Reviewed by Adam Barth.
https://bugs.webkit.org/show_bug.cgi?id=34070
Moves the try/catch for OSError exceptions in Executive.run_command
to Credentials.read_credentials() so that the unit test
webkitpy.scm_unittest.SCMClassTests.test_error_handlers can
assert that Executive.run_command throws an OSError exception.
* Scripts/webkitpy/credentials.py:
* Scripts/webkitpy/executive.py: Moved try/catch for OSError to
method Credentials.read_credentials().
* Scripts/webkitpy/executive_unittest.py: Removed tests that no longer
apply: test_run_command_with_bad_command_check_return_code and
test_run_command_with_bad_command_check_calls_error_handler. Added new
test to assert that run_command throws OSError exceptions.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53896 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 56c8294..fb73cac 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,22 @@
+2010-01-26 Daniel Bates <dbates at webkit.org>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34070
+
+ Moves the try/catch for OSError exceptions in Executive.run_command
+ to Credentials.read_credentials() so that the unit test
+ webkitpy.scm_unittest.SCMClassTests.test_error_handlers can
+ assert that Executive.run_command throws an OSError exception.
+
+ * Scripts/webkitpy/credentials.py:
+ * Scripts/webkitpy/executive.py: Moved try/catch for OSError to
+ method Credentials.read_credentials().
+ * Scripts/webkitpy/executive_unittest.py: Removed tests that no longer
+ apply: test_run_command_with_bad_command_check_return_code and
+ test_run_command_with_bad_command_check_calls_error_handler. Added new
+ test to assert that run_command throws OSError exceptions.
+
2010-01-26 Diego Gonzalez <diego.gonzalez at openbossa.org>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKitTools/Scripts/webkitpy/credentials.py b/WebKitTools/Scripts/webkitpy/credentials.py
index 17507bb..a4d8e34 100644
--- a/WebKitTools/Scripts/webkitpy/credentials.py
+++ b/WebKitTools/Scripts/webkitpy/credentials.py
@@ -111,8 +111,14 @@ class Credentials(object):
username = None
password = None
- if Git.in_working_directory(self.cwd):
- (username, password) = self._credentials_from_git()
+ try:
+ if Git.in_working_directory(self.cwd):
+ (username, password) = self._credentials_from_git()
+ except OSError, e:
+ # Catch and ignore OSError exceptions such as "no such file
+ # or directory" (OSError errno 2), which imply that the Git
+ # command cannot be found/is not installed.
+ pass
if not username or not password:
(username, password) = self._credentials_from_keychain(username)
diff --git a/WebKitTools/Scripts/webkitpy/executive.py b/WebKitTools/Scripts/webkitpy/executive.py
index f8e4cb4..50b119b 100644
--- a/WebKitTools/Scripts/webkitpy/executive.py
+++ b/WebKitTools/Scripts/webkitpy/executive.py
@@ -152,20 +152,14 @@ class Executive(object):
stderr = subprocess.STDOUT
else:
stderr = None
- try:
- process = subprocess.Popen(args,
- stdin=stdin,
- stdout=subprocess.PIPE,
- stderr=stderr,
- cwd=cwd)
- output = process.communicate(string_to_communicate)[0]
- exit_code = process.wait()
- except OSError, e:
- # Catch OSError exceptions. For example, "no such file or
- # directory" (i.e. OSError errno 2), when the command cannot be
- # found.
- output = e.strerror
- exit_code = e.errno
+
+ process = subprocess.Popen(args,
+ stdin=stdin,
+ stdout=subprocess.PIPE,
+ stderr=stderr,
+ cwd=cwd)
+ output = process.communicate(string_to_communicate)[0]
+ exit_code = process.wait()
if exit_code:
script_error = ScriptError(script_args=args,
exit_code=exit_code,
diff --git a/WebKitTools/Scripts/webkitpy/executive_unittest.py b/WebKitTools/Scripts/webkitpy/executive_unittest.py
index 6ab0d10..f78e301 100644
--- a/WebKitTools/Scripts/webkitpy/executive_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/executive_unittest.py
@@ -28,21 +28,14 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import unittest
-from webkitpy.executive import Executive, ScriptError, run_command
+from webkitpy.executive import Executive, run_command
class ExecutiveTest(unittest.TestCase):
- def test_run_command_with_bad_command_check_return_code(self):
- self.assertEqual(run_command(["foo_bar_command_blah"], error_handler=Executive.ignore_error, return_exit_code=True), 2)
-
- def test_run_command_with_bad_command_check_calls_error_handler(self):
- self.didHandleErrorGetCalled = False
- def handleError(scriptError):
- self.didHandleErrorGetCalled = True
- self.assertEqual(scriptError.exit_code, 2)
-
- run_command(["foo_bar_command_blah"], error_handler=handleError)
- self.assertTrue(self.didHandleErrorGetCalled)
+ def test_run_command_with_bad_command(self):
+ def run_bad_command():
+ run_command(["foo_bar_command_blah"], error_handler=Executive.ignore_error, return_exit_code=True)
+ self.failUnlessRaises(OSError, run_bad_command)
if __name__ == '__main__':
unittest.main()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list