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

eric at webkit.org eric at webkit.org
Wed Apr 7 23:43:04 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b3eef8e2bdcaa2b86bbfbe7048cfc3df54c6dbae
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 16 11:02:32 2009 +0000

    2009-11-16  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            Re-factor workqueue_unittest to allow for more than one test.
            https://bugs.webkit.org/show_bug.cgi?id=31535
    
            * Scripts/modules/workqueue_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51023 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index a24b07a..4ccefce 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -2,6 +2,15 @@
 
         Reviewed by Adam Barth.
 
+        Re-factor workqueue_unittest to allow for more than one test.
+        https://bugs.webkit.org/show_bug.cgi?id=31535
+
+        * Scripts/modules/workqueue_unittest.py:
+
+2009-11-16  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
         land-patches needs to be re-factored into smaller chunks
         https://bugs.webkit.org/show_bug.cgi?id=31532
 
diff --git a/WebKitTools/Scripts/modules/workqueue_unittest.py b/WebKitTools/Scripts/modules/workqueue_unittest.py
index f3fa310..ed7d0b2 100644
--- a/WebKitTools/Scripts/modules/workqueue_unittest.py
+++ b/WebKitTools/Scripts/modules/workqueue_unittest.py
@@ -34,40 +34,19 @@ import unittest
 
 from modules.workqueue import WorkQueue, WorkQueueDelegate
 
-class WorkQueueTest(unittest.TestCase, WorkQueueDelegate):
-    def test_trivial(self):
-        self.set_up()
-        work_queue = WorkQueue(self)
-        work_queue.run()
-        self.assertEquals(self.callbacks, [
-            'queue_log_path',
-            'status_host',
-            'begin_work_queue',
-            'should_continue_work_queue',
-            'next_work_item',
-            'should_proceed_with_work_item',
-            'work_logs_directory',
-            'process_work_item',
-            'should_continue_work_queue'])
-        self.clean_up()
-
-    def set_up(self):
+class LoggingDelegate(WorkQueueDelegate):
+    def __init__(self, test):
+        self.test = test
         self.callbacks = []
         self.run_before = False
-        self.temp_dir = tempfile.mkdtemp(suffix="work_queue_test_logs")
-
-    def clean_up(self):
-        os.path.exists(self.queue_log_path())
-        os.path.exists(os.path.join(self.work_logs_directory(), "42.log"))
-        shutil.rmtree(self.temp_dir)
 
     def queue_log_path(self):
         self.callbacks.append("queue_log_path")
-        return os.path.join(self.temp_dir, "queue_log_path")
+        return os.path.join(self.test.temp_dir, "queue_log_path")
 
     def work_logs_directory(self):
         self.callbacks.append("work_logs_directory")
-        return os.path.join(self.temp_dir, "work_log_path")
+        return os.path.join(self.test.temp_dir, "work_log_path")
 
     def status_host(self):
         self.callbacks.append("status_host")
@@ -89,16 +68,40 @@ class WorkQueueTest(unittest.TestCase, WorkQueueDelegate):
 
     def should_proceed_with_work_item(self, work_item):
         self.callbacks.append("should_proceed_with_work_item")
-        self.assertEquals(work_item, "work_item")
+        self.test.assertEquals(work_item, "work_item")
         return (True, "waiting_message", 42)
 
     def process_work_item(self, work_item):
         self.callbacks.append("process_work_item")
-        self.assertEquals(work_item, "work_item")
+        self.test.assertEquals(work_item, "work_item")
 
     def handle_unexpected_error(self, work_item, message):
         self.callbacks.append("handle_unexpected_error")
-        self.assertEquals(work_item, "work_item")
+        self.test.assertEquals(work_item, "work_item")
+
+class WorkQueueTest(unittest.TestCase):
+    def test_trivial(self):
+        delegate = LoggingDelegate(self)
+        work_queue = WorkQueue(delegate)
+        work_queue.run()
+        self.assertEquals(delegate.callbacks, [
+            'queue_log_path',
+            'status_host',
+            'begin_work_queue',
+            'should_continue_work_queue',
+            'next_work_item',
+            'should_proceed_with_work_item',
+            'work_logs_directory',
+            'process_work_item',
+            'should_continue_work_queue'])
+        self.assertTrue(os.path.exists(delegate.queue_log_path()))
+        self.assertTrue(os.path.exists(os.path.join(delegate.work_logs_directory(), "42.log")))
+
+    def setUp(self):
+        self.temp_dir = tempfile.mkdtemp(suffix="work_queue_test_logs")
+
+    def tearDown(self):
+        shutil.rmtree(self.temp_dir)
 
 
 if __name__ == '__main__':

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list