[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

abarth at webkit.org abarth at webkit.org
Wed Apr 7 23:53:12 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 7ea3c5fb3665e81237524f3682003ba54b326b7f
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 21 03:53:27 2009 +0000

    2009-11-20  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            Fix a bunch of unit test regressions from our recent bugzilla-toll hacking
            https://bugs.webkit.org/show_bug.cgi?id=31758
    
            * Scripts/modules/multicommandtool.py:
             - Allow passing of explicit commands to MultiCommandTool.__init__
            * Scripts/modules/multicommandtool_unittest.py:
             - Use new Command.name naming system.
             - Test Command auto-discovery.
            * Scripts/modules/workqueue.py:
             - bug_id no longer exists, use patch['bug_id'] instead.
            * Scripts/modules/workqueue_unittest.py:
             - WorkQueues require names now.
             - should_proceed_with_work_item must return a patch object.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51277 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 5ebaa3f..2efb2b9 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,21 @@
+2009-11-20  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        Fix a bunch of unit test regressions from our recent bugzilla-toll hacking
+        https://bugs.webkit.org/show_bug.cgi?id=31758
+
+        * Scripts/modules/multicommandtool.py:
+         - Allow passing of explicit commands to MultiCommandTool.__init__
+        * Scripts/modules/multicommandtool_unittest.py:
+         - Use new Command.name naming system.
+         - Test Command auto-discovery.
+        * Scripts/modules/workqueue.py:
+         - bug_id no longer exists, use patch['bug_id'] instead.
+        * Scripts/modules/workqueue_unittest.py:
+         - WorkQueues require names now.
+         - should_proceed_with_work_item must return a patch object.
+
 2009-11-20  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Beth Dakin.
diff --git a/WebKitTools/Scripts/modules/bugzilla.py b/WebKitTools/Scripts/modules/bugzilla.py
index 084c1c3..e663398 100644
--- a/WebKitTools/Scripts/modules/bugzilla.py
+++ b/WebKitTools/Scripts/modules/bugzilla.py
@@ -377,7 +377,7 @@ class Bugzilla:
         if self.dryrun:
             log(comment_text)
             return
-        
+
         self.browser.open("%sattachment.cgi?action=enter&bugid=%s" % (self.bug_server_url, bug_id))
         self.browser.select_form(name="entryform")
         self._fill_attachment_form(description, patch_file_object, mark_for_review=mark_for_review, mark_for_commit_queue=mark_for_commit_queue, bug_id=bug_id)
diff --git a/WebKitTools/Scripts/modules/multicommandtool.py b/WebKitTools/Scripts/modules/multicommandtool.py
index 5692404..fe3c2d4 100644
--- a/WebKitTools/Scripts/modules/multicommandtool.py
+++ b/WebKitTools/Scripts/modules/multicommandtool.py
@@ -77,8 +77,9 @@ class HelpPrintingOptionParser(OptionParser):
 
 
 class MultiCommandTool(object):
-    def __init__(self):
-        self.commands = [cls() for cls in self._find_all_commands() if cls.name]
+    def __init__(self, commands=None):
+        # Allow the unit tests to disable command auto-discovery.
+        self.commands = commands or [cls() for cls in self._find_all_commands() if cls.name]
         # FIXME: Calling self._commands_usage() in the constructor is bad because
         # it calls self.should_show_command_help which is subclass-defined.
         # The subclass will not be fully initialized at this point.
diff --git a/WebKitTools/Scripts/modules/multicommandtool_unittest.py b/WebKitTools/Scripts/modules/multicommandtool_unittest.py
index 49fc71e..33cfdf2 100644
--- a/WebKitTools/Scripts/modules/multicommandtool_unittest.py
+++ b/WebKitTools/Scripts/modules/multicommandtool_unittest.py
@@ -34,6 +34,7 @@ from StringIO import StringIO
 from optparse import make_option
 
 class TrivialCommand(Command):
+    name = "trivial"
     def __init__(self, **kwargs):
         Command.__init__(self, "help text", **kwargs)
 
@@ -44,14 +45,14 @@ class TrivialCommand(Command):
 class CommandTest(unittest.TestCase):
     def test_name_with_arguments(self):
         command_with_args = TrivialCommand(argument_names="ARG1 ARG2")
-        self.assertEqual(command_with_args.name_with_arguments("simple"), "simple ARG1 ARG2")
+        self.assertEqual(command_with_args.name_with_arguments(), "trivial ARG1 ARG2")
 
         command_with_args = TrivialCommand(options=[make_option("--my_option")])
-        self.assertEqual(command_with_args.name_with_arguments("simple"), "simple [options]")
+        self.assertEqual(command_with_args.name_with_arguments(), "trivial [options]")
 
 
 class TrivialTool(MultiCommandTool):
-    def __init__(self, commands):
+    def __init__(self, commands=None):
         MultiCommandTool.__init__(self, commands)
 
     def should_show_command_help(self, command):
@@ -62,7 +63,6 @@ class TrivialTool(MultiCommandTool):
 
 
 class MultiCommandToolTest(unittest.TestCase):
-
     def _capture_stderr(self):
         self.saved_stderr = sys.stderr
         sys.stderr = StringIO()
@@ -91,21 +91,19 @@ class MultiCommandToolTest(unittest.TestCase):
         self._assert_split(full_args, full_args_expected)
 
     def test_command_by_name(self):
-        foo_command = { "name" : "foo_command", "object" :  TrivialCommand() }
-        tool = TrivialTool([foo_command])
-
-        self.assertEqual(tool.command_by_name("foo_command"), foo_command)
+        # This also tests Command auto-discovery.
+        tool = TrivialTool()
+        self.assertEqual(tool.command_by_name("trivial").name, "trivial")
         self.assertEqual(tool.command_by_name("bar"), None)
 
     def test_command_help(self):
-        command_with_args = TrivialCommand(options=[make_option("--my_option")])
-        foo_command = { "name" : "foo_command", "object" :  command_with_args }
-        tool = TrivialTool([foo_command])
+        command_with_options = TrivialCommand(options=[make_option("--my_option")])
+        tool = TrivialTool(commands=[command_with_options])
 
         self._capture_stderr()
-        exit_code = tool.main(["tool", "help", "foo_command"])
+        exit_code = tool.main(["tool", "help", "trivial"])
         help_text = self._release_stderr()
-        expected_subcommand_help = "  foo_command [options]   help text\nOptions:\n  --my_option=MY_OPTION\n\n"
+        expected_subcommand_help = "  trivial [options]   help text\nOptions:\n  --my_option=MY_OPTION\n\n"
         self.assertEqual(exit_code, 0)
         self.assertEqual(help_text, expected_subcommand_help)
 
diff --git a/WebKitTools/Scripts/modules/workqueue.py b/WebKitTools/Scripts/modules/workqueue.py
index 8715e1d..c3761aa 100644
--- a/WebKitTools/Scripts/modules/workqueue.py
+++ b/WebKitTools/Scripts/modules/workqueue.py
@@ -109,6 +109,7 @@ class WorkQueue:
                 self._sleep("Exception while preparing queue: %s." % e)
                 continue
 
+            # FIXME: Work logs should not depend on bug_id specificaly.
             self._open_work_log(patch["bug_id"])
             try:
                 self._delegate.process_work_item(work_item)
diff --git a/WebKitTools/Scripts/modules/workqueue_unittest.py b/WebKitTools/Scripts/modules/workqueue_unittest.py
index 3428acc..1e9c8ad 100644
--- a/WebKitTools/Scripts/modules/workqueue_unittest.py
+++ b/WebKitTools/Scripts/modules/workqueue_unittest.py
@@ -85,7 +85,8 @@ class LoggingDelegate(WorkQueueDelegate):
     def should_proceed_with_work_item(self, work_item):
         self.record("should_proceed_with_work_item")
         self._test.assertEquals(work_item, "work_item")
-        return (True, "waiting_message", 42)
+        fake_patch = { 'bug_id' : 42 }
+        return (True, "waiting_message", fake_patch)
 
     def process_work_item(self, work_item):
         self.record("process_work_item")
@@ -110,12 +111,13 @@ class NotSafeToProceedDelegate(LoggingDelegate):
     def should_proceed_with_work_item(self, work_item):
         self.record("should_proceed_with_work_item")
         self._test.assertEquals(work_item, "work_item")
-        return (False, "waiting_message", 42)
+        fake_patch = { 'bug_id' : 42 }
+        return (False, "waiting_message", fake_patch)
 
 
 class FastWorkQueue(WorkQueue):
     def __init__(self, delegate):
-        WorkQueue.__init__(self, delegate)
+        WorkQueue.__init__(self, "fast-queue", delegate)
 
     # No sleep for the wicked.
     seconds_to_sleep = 0
@@ -127,7 +129,7 @@ class FastWorkQueue(WorkQueue):
 class WorkQueueTest(unittest.TestCase):
     def test_trivial(self):
         delegate = LoggingDelegate(self)
-        work_queue = WorkQueue(delegate)
+        work_queue = WorkQueue("trivial-queue", delegate)
         work_queue.run()
         self.assertEquals(delegate._callbacks, LoggingDelegate.expected_callbacks)
         self.assertTrue(os.path.exists(delegate.queue_log_path()))
@@ -135,7 +137,7 @@ class WorkQueueTest(unittest.TestCase):
 
     def test_unexpected_error(self):
         delegate = ThrowErrorDelegate(self, 3)
-        work_queue = WorkQueue(delegate)
+        work_queue = WorkQueue("error-queue", delegate)
         work_queue.run()
         expected_callbacks = LoggingDelegate.expected_callbacks[:]
         work_item_index = expected_callbacks.index('process_work_item')
@@ -146,7 +148,7 @@ class WorkQueueTest(unittest.TestCase):
 
     def test_handled_error(self):
         delegate = ThrowErrorDelegate(self, WorkQueue.handled_error_code)
-        work_queue = WorkQueue(delegate)
+        work_queue = WorkQueue("handled-error-queue", delegate)
         work_queue.run()
         self.assertEquals(delegate._callbacks, LoggingDelegate.expected_callbacks)
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list