[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
abarth at webkit.org
abarth at webkit.org
Thu Feb 4 21:26:31 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 4d9675ef6e3b9461516a2ab5a410dcc0519aedae
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Jan 24 12:25:21 2010 +0000
Rubber stamped by Eric Seidel.
More pep8 compliance.
* Scripts/webkitpy/mock_bugzillatool.py:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53778 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 1a00bb4..47fceb5 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -4,6 +4,14 @@
More pep8 compliance.
+ * Scripts/webkitpy/mock_bugzillatool.py:
+
+2010-01-24 Adam Barth <abarth at webkit.org>
+
+ Rubber stamped by Eric Seidel.
+
+ More pep8 compliance.
+
* Scripts/webkitpy/executive.py:
* Scripts/webkitpy/grammar.py:
diff --git a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
index 6a29407..b5fc835 100644
--- a/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
+++ b/WebKitTools/Scripts/webkitpy/mock_bugzillatool.py
@@ -33,167 +33,217 @@ from webkitpy.scm import CommitMessage
from webkitpy.committers import CommitterList, Reviewer
from webkitpy.bugzilla import Bug, Attachment
+
def _id_to_object_dictionary(*objects):
dictionary = {}
for thing in objects:
dictionary[thing["id"]] = thing
return dictionary
+
# FIXME: The ids should be 1, 2, 3 instead of crazy numbers.
+
+
_patch1 = {
- "id" : 197,
- "bug_id" : 42,
- "url" : "http://example.com/197",
- "is_obsolete" : False,
- "is_patch" : True,
- "review" : "+",
- "reviewer_email" : "foo at bar.com",
- "commit-queue" : "+",
- "committer_email" : "foo at bar.com",
- "attacher_email" : "Contributer1",
+ "id": 197,
+ "bug_id": 42,
+ "url": "http://example.com/197",
+ "is_obsolete": False,
+ "is_patch": True,
+ "review": "+",
+ "reviewer_email": "foo at bar.com",
+ "commit-queue": "+",
+ "committer_email": "foo at bar.com",
+ "attacher_email": "Contributer1",
}
+
+
_patch2 = {
- "id" : 128,
- "bug_id" : 42,
- "url" : "http://example.com/128",
- "is_obsolete" : False,
- "is_patch" : True,
- "review" : "+",
- "reviewer_email" : "foo at bar.com",
- "commit-queue" : "+",
- "committer_email" : "non-committer at example.com",
- "attacher_email" : "eric at webkit.org",
+ "id": 128,
+ "bug_id": 42,
+ "url": "http://example.com/128",
+ "is_obsolete": False,
+ "is_patch": True,
+ "review": "+",
+ "reviewer_email": "foo at bar.com",
+ "commit-queue": "+",
+ "committer_email": "non-committer at example.com",
+ "attacher_email": "eric at webkit.org",
}
+
+
_patch3 = {
- "id" : 103,
- "bug_id" : 75,
- "url" : "http://example.com/103",
- "is_obsolete" : False,
- "is_patch" : True,
- "review" : "?",
- "attacher_email" : "eric at webkit.org",
+ "id": 103,
+ "bug_id": 75,
+ "url": "http://example.com/103",
+ "is_obsolete": False,
+ "is_patch": True,
+ "review": "?",
+ "attacher_email": "eric at webkit.org",
}
+
+
_patch4 = {
- "id" : 104,
- "bug_id" : 77,
- "url" : "http://example.com/103",
- "is_obsolete" : False,
- "is_patch" : True,
- "review" : "+",
- "commit-queue" : "?",
- "reviewer_email" : "foo at bar.com",
- "attacher_email" : "Contributer2",
+ "id": 104,
+ "bug_id": 77,
+ "url": "http://example.com/103",
+ "is_obsolete": False,
+ "is_patch": True,
+ "review": "+",
+ "commit-queue": "?",
+ "reviewer_email": "foo at bar.com",
+ "attacher_email": "Contributer2",
}
+
+
_patch5 = {
- "id" : 105,
- "bug_id" : 77,
- "url" : "http://example.com/103",
- "is_obsolete" : False,
- "is_patch" : True,
- "review" : "+",
- "reviewer_email" : "foo at bar.com",
- "attacher_email" : "eric at webkit.org",
+ "id": 105,
+ "bug_id": 77,
+ "url": "http://example.com/103",
+ "is_obsolete": False,
+ "is_patch": True,
+ "review": "+",
+ "reviewer_email": "foo at bar.com",
+ "attacher_email": "eric at webkit.org",
}
+
+
_patch6 = { # Valid committer, but no reviewer.
- "id" : 106,
- "bug_id" : 77,
- "url" : "http://example.com/103",
- "is_obsolete" : False,
- "is_patch" : True,
- "commit-queue" : "+",
- "committer_email" : "foo at bar.com",
- "attacher_email" : "eric at webkit.org",
+ "id": 106,
+ "bug_id": 77,
+ "url": "http://example.com/103",
+ "is_obsolete": False,
+ "is_patch": True,
+ "commit-queue": "+",
+ "committer_email": "foo at bar.com",
+ "attacher_email": "eric at webkit.org",
}
+
+
_patch7 = { # Valid review, patch is marked obsolete.
- "id" : 107,
- "bug_id" : 76,
- "url" : "http://example.com/103",
- "is_obsolete" : True,
- "is_patch" : True,
- "review" : "+",
- "reviewer_email" : "foo at bar.com",
- "attacher_email" : "eric at webkit.org",
+ "id": 107,
+ "bug_id": 76,
+ "url": "http://example.com/103",
+ "is_obsolete": True,
+ "is_patch": True,
+ "review": "+",
+ "reviewer_email": "foo at bar.com",
+ "attacher_email": "eric at webkit.org",
}
-# This must be defined before we define the bugs, thus we don't use MockBugzilla.unassigned_email directly.
+# This must be defined before we define the bugs, thus we don't use
+# MockBugzilla.unassigned_email directly.
_unassigned_email = "unassigned at example.com"
+
# FIXME: The ids should be 1, 2, 3 instead of crazy numbers.
+
+
_bug1 = {
- "id" : 42,
- "title" : "Bug with two r+'d and cq+'d patches, one of which has an invalid commit-queue setter.",
- "assigned_to_email" : _unassigned_email,
- "attachments" : [_patch1, _patch2],
+ "id": 42,
+ "title": "Bug with two r+'d and cq+'d patches, one of which has an "
+ "invalid commit-queue setter.",
+ "assigned_to_email": _unassigned_email,
+ "attachments": [_patch1, _patch2],
}
+
+
_bug2 = {
- "id" : 75,
- "title" : "Bug with a patch needing review.",
- "assigned_to_email" : "foo at foo.com",
- "attachments" : [_patch3],
+ "id": 75,
+ "title": "Bug with a patch needing review.",
+ "assigned_to_email": "foo at foo.com",
+ "attachments": [_patch3],
}
+
+
_bug3 = {
- "id" : 76,
- "title" : "The third bug",
- "assigned_to_email" : _unassigned_email,
- "attachments" : [_patch7],
+ "id": 76,
+ "title": "The third bug",
+ "assigned_to_email": _unassigned_email,
+ "attachments": [_patch7],
}
+
+
_bug4 = {
- "id" : 77,
- "title" : "The fourth bug",
- "assigned_to_email" : "foo at foo.com",
- "attachments" : [_patch4, _patch5, _patch6],
+ "id": 77,
+ "title": "The fourth bug",
+ "assigned_to_email": "foo at foo.com",
+ "attachments": [_patch4, _patch5, _patch6],
}
+
class MockBugzillaQueries(Mock):
+
def __init__(self, bugzilla):
Mock.__init__(self)
self._bugzilla = bugzilla
def _all_bugs(self):
- return map(lambda bug_dictionary: Bug(bug_dictionary, self._bugzilla), self._bugzilla.bug_cache.values())
+ return map(lambda bug_dictionary: Bug(bug_dictionary, self._bugzilla),
+ self._bugzilla.bug_cache.values())
def fetch_bug_ids_from_commit_queue(self):
- bugs_with_commit_queued_patches = filter(lambda bug: bug.commit_queued_patches(), self._all_bugs())
+ bugs_with_commit_queued_patches = filter(
+ lambda bug: bug.commit_queued_patches(),
+ self._all_bugs())
return map(lambda bug: bug.id(), bugs_with_commit_queued_patches)
def fetch_attachment_ids_from_review_queue(self):
- unreviewed_patches = sum([bug.unreviewed_patches() for bug in self._all_bugs()], [])
+ unreviewed_patches = sum([bug.unreviewed_patches()
+ for bug in self._all_bugs()], [])
return map(lambda patch: patch.id(), unreviewed_patches)
def fetch_patches_from_commit_queue(self):
- return sum([bug.commit_queued_patches() for bug in self._all_bugs()], [])
+ return sum([bug.commit_queued_patches()
+ for bug in self._all_bugs()], [])
def fetch_bug_ids_from_pending_commit_list(self):
- bugs_with_reviewed_patches = filter(lambda bug: bug.reviewed_patches(), self._all_bugs())
+ bugs_with_reviewed_patches = filter(lambda bug: bug.reviewed_patches(),
+ self._all_bugs())
bug_ids = map(lambda bug: bug.id(), bugs_with_reviewed_patches)
- # NOTE: This manual hack here is to allow testing logging in test_assign_to_committer
- # the real pending-commit query on bugzilla will return bugs with patches which have r+, but are also obsolete.
+ # NOTE: This manual hack here is to allow testing logging in
+ # test_assign_to_committer the real pending-commit query on bugzilla
+ # will return bugs with patches which have r+, but are also obsolete.
return bug_ids + [76]
def fetch_patches_from_pending_commit_list(self):
return sum([bug.reviewed_patches() for bug in self._all_bugs()], [])
-
-# FIXME: Bugzilla is the wrong Mock-point. Once we have a BugzillaNetwork class we should mock that instead.
+# FIXME: Bugzilla is the wrong Mock-point. Once we have a BugzillaNetwork
+# class we should mock that instead.
# Most of this class is just copy/paste from Bugzilla.
+
+
class MockBugzilla(Mock):
+
bug_server_url = "http://example.com"
+
unassigned_email = _unassigned_email
+
bug_cache = _id_to_object_dictionary(_bug1, _bug2, _bug3, _bug4)
- attachment_cache = _id_to_object_dictionary(_patch1, _patch2, _patch3, _patch4, _patch5, _patch6, _patch7)
+
+ attachment_cache = _id_to_object_dictionary(_patch1,
+ _patch2,
+ _patch3,
+ _patch4,
+ _patch5,
+ _patch6,
+ _patch7)
def __init__(self):
Mock.__init__(self)
self.queries = MockBugzillaQueries(self)
- self.committers = CommitterList(reviewers=[Reviewer("Foo Bar", "foo at bar.com")])
+ self.committers = CommitterList(reviewers=[Reviewer("Foo Bar",
+ "foo at bar.com")])
def fetch_bug(self, bug_id):
return Bug(self.bug_cache.get(bug_id), self)
def fetch_attachment(self, attachment_id):
- attachment_dictionary = self.attachment_cache[attachment_id] # This could be changed to .get() if we wish to allow failed lookups.
+ # This could be changed to .get() if we wish to allow failed lookups.
+ attachment_dictionary = self.attachment_cache[attachment_id]
bug = self.fetch_bug(attachment_dictionary["bug_id"])
for attachment in bug.attachments(include_obsolete=True):
if attachment.id() == int(attachment_id):
@@ -213,13 +263,14 @@ class MockBugzilla(Mock):
class MockBuildBot(Mock):
+
def builder_statuses(self):
return [{
"name": "Builder1",
- "is_green": True
+ "is_green": True,
}, {
"name": "Builder2",
- "is_green": True
+ "is_green": True,
}]
def red_core_builders_names(self):
@@ -227,6 +278,7 @@ class MockBuildBot(Mock):
class MockSCM(Mock):
+
def __init__(self):
Mock.__init__(self)
self.checkout_root = os.getcwd()
@@ -239,9 +291,11 @@ class MockSCM(Mock):
def commit_message_for_local_commit(self, commit_id):
if commit_id == "Commitish1":
- return CommitMessage("CommitMessage1\nhttps://bugs.example.org/show_bug.cgi?id=42\n")
+ return CommitMessage("CommitMessage1\n" \
+ "https://bugs.example.org/show_bug.cgi?id=42\n")
if commit_id == "Commitish2":
- return CommitMessage("CommitMessage2\nhttps://bugs.example.org/show_bug.cgi?id=75\n")
+ return CommitMessage("CommitMessage2\n" \
+ "https://bugs.example.org/show_bug.cgi?id=75\n")
raise Exception("Bogus commit_id in commit_message_for_local_commit.")
def create_patch_from_local_commit(self, commit_id):
@@ -252,18 +306,20 @@ class MockSCM(Mock):
raise Exception("Bogus commit_id in commit_message_for_local_commit.")
def diff_for_revision(self, revision):
- return "DiffForRevision%s\nhttp://bugs.webkit.org/show_bug.cgi?id=12345" % revision
+ return "DiffForRevision%s\n" \
+ "http://bugs.webkit.org/show_bug.cgi?id=12345" % revision
def svn_revision_from_commit_text(self, commit_text):
return "49824"
def modified_changelogs(self):
- # Ideally we'd return something more interesting here.
- # The problem is that LandDiff will try to actually read the path from disk!
+ # Ideally we'd return something more interesting here. The problem is
+ # that LandDiff will try to actually read the path from disk!
return []
class MockUser(object):
+
def prompt(self, message):
return "Mock user response"
@@ -281,6 +337,7 @@ class MockUser(object):
class MockStatusServer(object):
+
def __init__(self):
self.host = "example.com"
@@ -292,6 +349,7 @@ class MockStatusServer(object):
class MockBugzillaTool():
+
def __init__(self):
self.bugs = MockBugzilla()
self.buildbot = MockBuildBot()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list