[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373
eric at webkit.org
eric at webkit.org
Thu Apr 8 00:52:25 UTC 2010
The following commit has been merged in the webkit-1.2 branch:
commit 9554926da941a1132be1eea8ae3acb8981c4286a
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 30 18:37:32 2009 +0000
2009-12-30 Eric Seidel <eric at webkit.org>
Reviewed by Adam Barth.
logging.py should be renamed to webkit_logging.py and eventually die
https://bugs.webkit.org/show_bug.cgi?id=33058
Change all imports of "logging" to webkit_logging,
except the ones which came from Google's cpp_lint.py and diff_parser.py
which clearly are assuming python's logging.py.
* Scripts/modules/bugzilla.py:
* Scripts/modules/buildbot.py:
* Scripts/modules/buildsteps.py:
* Scripts/modules/commands/download.py:
* Scripts/modules/commands/queries.py:
* Scripts/modules/commands/queues.py:
* Scripts/modules/commands/upload.py:
* Scripts/modules/credentials.py:
* Scripts/modules/executive.py:
* Scripts/modules/multicommandtool.py:
* Scripts/modules/queueengine.py:
* Scripts/modules/scm.py:
* Scripts/modules/statusbot.py:
* Scripts/modules/stepsequence.py:
* Scripts/modules/webkit_logging.py: Renamed from WebKitTools/Scripts/modules/logging.py.
* Scripts/modules/webkit_logging_unittest.py: Renamed from WebKitTools/Scripts/modules/logging_unittest.py.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 247ba8c..69c3817 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,31 @@
+2009-12-30 Eric Seidel <eric at webkit.org>
+
+ Reviewed by Adam Barth.
+
+ logging.py should be renamed to webkit_logging.py and eventually die
+ https://bugs.webkit.org/show_bug.cgi?id=33058
+
+ Change all imports of "logging" to webkit_logging,
+ except the ones which came from Google's cpp_lint.py and diff_parser.py
+ which clearly are assuming python's logging.py.
+
+ * Scripts/modules/bugzilla.py:
+ * Scripts/modules/buildbot.py:
+ * Scripts/modules/buildsteps.py:
+ * Scripts/modules/commands/download.py:
+ * Scripts/modules/commands/queries.py:
+ * Scripts/modules/commands/queues.py:
+ * Scripts/modules/commands/upload.py:
+ * Scripts/modules/credentials.py:
+ * Scripts/modules/executive.py:
+ * Scripts/modules/multicommandtool.py:
+ * Scripts/modules/queueengine.py:
+ * Scripts/modules/scm.py:
+ * Scripts/modules/statusbot.py:
+ * Scripts/modules/stepsequence.py:
+ * Scripts/modules/webkit_logging.py: Renamed from WebKitTools/Scripts/modules/logging.py.
+ * Scripts/modules/webkit_logging_unittest.py: Renamed from WebKitTools/Scripts/modules/logging_unittest.py.
+
2009-12-30 Jakub Wieczorek <faw217 at gmail.com>
Reviewed by Simon Hausmann.
diff --git a/WebKitTools/Scripts/bugzilla-tool b/WebKitTools/Scripts/bugzilla-tool
index 5dbf91b..9305b66 100755
--- a/WebKitTools/Scripts/bugzilla-tool
+++ b/WebKitTools/Scripts/bugzilla-tool
@@ -40,7 +40,7 @@ from modules.commands.queries import *
from modules.commands.queues import *
from modules.commands.upload import *
from modules.executive import Executive
-from modules.logging import log
+from modules.webkit_logging import log
from modules.multicommandtool import MultiCommandTool
from modules.scm import detect_scm_system
from modules.user import User
diff --git a/WebKitTools/Scripts/modules/bugzilla.py b/WebKitTools/Scripts/modules/bugzilla.py
index 4ff3cb9..b443533 100644
--- a/WebKitTools/Scripts/modules/bugzilla.py
+++ b/WebKitTools/Scripts/modules/bugzilla.py
@@ -35,7 +35,7 @@ import subprocess
from datetime import datetime # used in timestamp()
# Import WebKit-specific modules.
-from modules.logging import error, log
+from modules.webkit_logging import error, log
from modules.committers import CommitterList
from modules.credentials import Credentials
diff --git a/WebKitTools/Scripts/modules/buildbot.py b/WebKitTools/Scripts/modules/buildbot.py
index 548cad8..df5d8c2 100644
--- a/WebKitTools/Scripts/modules/buildbot.py
+++ b/WebKitTools/Scripts/modules/buildbot.py
@@ -32,7 +32,7 @@ import re
import urllib2
# Import WebKit-specific modules.
-from modules.logging import log
+from modules.webkit_logging import log
# WebKit includes a built copy of BeautifulSoup in Scripts/modules
# so this import should always succeed.
diff --git a/WebKitTools/Scripts/modules/buildsteps.py b/WebKitTools/Scripts/modules/buildsteps.py
index e815370..f375415 100644
--- a/WebKitTools/Scripts/modules/buildsteps.py
+++ b/WebKitTools/Scripts/modules/buildsteps.py
@@ -33,7 +33,7 @@ from optparse import make_option
from modules.comments import bug_comment_from_commit_text
from modules.grammar import pluralize
-from modules.logging import log, error
+from modules.webkit_logging import log, error
from modules.webkitport import WebKitPort
from modules.changelogs import ChangeLog
diff --git a/WebKitTools/Scripts/modules/commands/download.py b/WebKitTools/Scripts/modules/commands/download.py
index b52c85e..bcdf34d 100644
--- a/WebKitTools/Scripts/modules/commands/download.py
+++ b/WebKitTools/Scripts/modules/commands/download.py
@@ -39,7 +39,7 @@ from modules.changelogs import ChangeLog
from modules.comments import bug_comment_from_commit_text
from modules.executive import ScriptError
from modules.grammar import pluralize
-from modules.logging import error, log
+from modules.webkit_logging import error, log
from modules.multicommandtool import AbstractDeclarativeCommmand, Command
from modules.stepsequence import StepSequence
diff --git a/WebKitTools/Scripts/modules/commands/queries.py b/WebKitTools/Scripts/modules/commands/queries.py
index e1a0e62..d37fa06 100644
--- a/WebKitTools/Scripts/modules/commands/queries.py
+++ b/WebKitTools/Scripts/modules/commands/queries.py
@@ -33,7 +33,7 @@ from optparse import make_option
from modules.buildbot import BuildBot
from modules.committers import CommitterList
-from modules.logging import log
+from modules.webkit_logging import log
from modules.multicommandtool import Command
diff --git a/WebKitTools/Scripts/modules/commands/queues.py b/WebKitTools/Scripts/modules/commands/queues.py
index 7d59a99..c8d34c7 100644
--- a/WebKitTools/Scripts/modules/commands/queues.py
+++ b/WebKitTools/Scripts/modules/commands/queues.py
@@ -36,7 +36,7 @@ from StringIO import StringIO
from modules.executive import ScriptError
from modules.grammar import pluralize
-from modules.logging import error, log
+from modules.webkit_logging import error, log
from modules.multicommandtool import Command
from modules.patchcollection import PersistentPatchCollection, PersistentPatchCollectionDelegate
from modules.statusbot import StatusBot
diff --git a/WebKitTools/Scripts/modules/commands/upload.py b/WebKitTools/Scripts/modules/commands/upload.py
index 85facbf..ac7995f 100644
--- a/WebKitTools/Scripts/modules/commands/upload.py
+++ b/WebKitTools/Scripts/modules/commands/upload.py
@@ -41,7 +41,7 @@ from modules.commands.download import AbstractSequencedCommmand
from modules.comments import bug_comment_from_svn_revision
from modules.committers import CommitterList
from modules.grammar import pluralize
-from modules.logging import error, log
+from modules.webkit_logging import error, log
from modules.multicommandtool import Command, AbstractDeclarativeCommmand
# FIXME: Requires unit test.
diff --git a/WebKitTools/Scripts/modules/credentials.py b/WebKitTools/Scripts/modules/credentials.py
index fc73c90..5ca5983 100644
--- a/WebKitTools/Scripts/modules/credentials.py
+++ b/WebKitTools/Scripts/modules/credentials.py
@@ -35,7 +35,7 @@ import platform
import re
from modules.executive import Executive
-from modules.logging import log
+from modules.webkit_logging import log
from modules.scm import Git
class Credentials(object):
diff --git a/WebKitTools/Scripts/modules/executive.py b/WebKitTools/Scripts/modules/executive.py
index 8f294aa..115a8bc 100644
--- a/WebKitTools/Scripts/modules/executive.py
+++ b/WebKitTools/Scripts/modules/executive.py
@@ -32,7 +32,7 @@ import StringIO
import subprocess
import sys
-from modules.logging import tee
+from modules.webkit_logging import tee
class ScriptError(Exception):
diff --git a/WebKitTools/Scripts/modules/logging.py b/WebKitTools/Scripts/modules/logging.py
deleted file mode 100644
index 7b7cec5..0000000
--- a/WebKitTools/Scripts/modules/logging.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright (c) 2009, Google Inc. All rights reserved.
-# Copyright (c) 2009 Apple Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# WebKit's Python module for logging
-
-import os
-import sys
-
-def log(string):
- print >> sys.stderr, string
-
-def error(string):
- log("ERROR: %s" % string)
- exit(1)
-
-# Simple class to split output between multiple destinations
-class tee:
- def __init__(self, *files):
- self.files = files
-
- def write(self, string):
- for file in self.files:
- file.write(string)
-
-class OutputTee:
- def __init__(self):
- self._original_stdout = None
- self._original_stderr = None
- self._files_for_output = []
-
- def add_log(self, path):
- log_file = self._open_log_file(path)
- self._files_for_output.append(log_file)
- self._tee_outputs_to_files(self._files_for_output)
- return log_file
-
- def remove_log(self, log_file):
- self._files_for_output.remove(log_file)
- self._tee_outputs_to_files(self._files_for_output)
- log_file.close()
-
- @staticmethod
- def _open_log_file(log_path):
- (log_directory, log_name) = os.path.split(log_path)
- if log_directory and not os.path.exists(log_directory):
- os.makedirs(log_directory)
- return open(log_path, 'a+')
-
- def _tee_outputs_to_files(self, files):
- if not self._original_stdout:
- self._original_stdout = sys.stdout
- self._original_stderr = sys.stderr
- if files and len(files):
- sys.stdout = tee(self._original_stdout, *files)
- sys.stderr = tee(self._original_stderr, *files)
- else:
- sys.stdout = self._original_stdout
- sys.stderr = self._original_stderr
diff --git a/WebKitTools/Scripts/modules/logging_unittest.py b/WebKitTools/Scripts/modules/logging_unittest.py
deleted file mode 100644
index b09a563..0000000
--- a/WebKitTools/Scripts/modules/logging_unittest.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright (C) 2009 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-import os
-import subprocess
-import StringIO
-import tempfile
-import unittest
-
-from modules.executive import ScriptError
-from modules.logging import *
-
-class LoggingTest(unittest.TestCase):
-
- def assert_log_equals(self, log_input, expected_output):
- original_stderr = sys.stderr
- test_stderr = StringIO.StringIO()
- sys.stderr = test_stderr
-
- try:
- log(log_input)
- actual_output = test_stderr.getvalue()
- finally:
- original_stderr = original_stderr
-
- self.assertEquals(actual_output, expected_output, "log(\"%s\") expected: %s actual: %s" % (log_input, expected_output, actual_output))
-
- def test_log(self):
- self.assert_log_equals("test", "test\n")
-
- # Test that log() does not throw an exception when passed an object instead of a string.
- self.assert_log_equals(ScriptError(message="ScriptError"), "ScriptError\n")
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/WebKitTools/Scripts/modules/multicommandtool.py b/WebKitTools/Scripts/modules/multicommandtool.py
index 8d2c395..215e948 100644
--- a/WebKitTools/Scripts/modules/multicommandtool.py
+++ b/WebKitTools/Scripts/modules/multicommandtool.py
@@ -36,7 +36,7 @@ import sys
from optparse import OptionParser, IndentedHelpFormatter, SUPPRESS_USAGE, make_option
from modules.grammar import pluralize
-from modules.logging import log
+from modules.webkit_logging import log
class Command(object):
diff --git a/WebKitTools/Scripts/modules/queueengine.py b/WebKitTools/Scripts/modules/queueengine.py
index c263c05..8640f02 100644
--- a/WebKitTools/Scripts/modules/queueengine.py
+++ b/WebKitTools/Scripts/modules/queueengine.py
@@ -35,7 +35,7 @@ import traceback
from datetime import datetime, timedelta
from modules.executive import ScriptError
-from modules.logging import log, OutputTee
+from modules.webkit_logging import log, OutputTee
from modules.statusbot import StatusBot
class QueueEngineDelegate:
diff --git a/WebKitTools/Scripts/modules/scm.py b/WebKitTools/Scripts/modules/scm.py
index ff26693..3ef3093 100644
--- a/WebKitTools/Scripts/modules/scm.py
+++ b/WebKitTools/Scripts/modules/scm.py
@@ -36,7 +36,7 @@ import subprocess
# Import WebKit-specific modules.
from modules.changelogs import ChangeLog
from modules.executive import Executive, run_command, ScriptError
-from modules.logging import error, log
+from modules.webkit_logging import error, log
def detect_scm_system(path):
if SVN.in_working_directory(path):
diff --git a/WebKitTools/Scripts/modules/statusbot.py b/WebKitTools/Scripts/modules/statusbot.py
index 5f2dde8..2928a4e 100644
--- a/WebKitTools/Scripts/modules/statusbot.py
+++ b/WebKitTools/Scripts/modules/statusbot.py
@@ -28,7 +28,7 @@
#
# WebKit's Python module for interacting with the Commit Queue status page.
-from modules.logging import log
+from modules.webkit_logging import log
from modules.webkit_mechanize import Browser
# WebKit includes a built copy of BeautifulSoup in Scripts/modules
diff --git a/WebKitTools/Scripts/modules/stepsequence.py b/WebKitTools/Scripts/modules/stepsequence.py
index f7ebce9..39752c1 100644
--- a/WebKitTools/Scripts/modules/stepsequence.py
+++ b/WebKitTools/Scripts/modules/stepsequence.py
@@ -28,7 +28,7 @@
from modules.buildsteps import CommandOptions
from modules.executive import ScriptError
-from modules.logging import log
+from modules.webkit_logging import log
from modules.scm import CheckoutNeedsUpdate
from modules.queueengine import QueueEngine
diff --git a/WebKitTools/Scripts/modules/webkit_logging.py b/WebKitTools/Scripts/modules/webkit_logging.py
new file mode 100644
index 0000000..ba1c5eb
--- /dev/null
+++ b/WebKitTools/Scripts/modules/webkit_logging.py
@@ -0,0 +1,85 @@
+# Copyright (c) 2009, Google Inc. All rights reserved.
+# Copyright (c) 2009 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# WebKit's Python module for logging
+# This module is now deprecated in favor of python's built-in logging.py.
+
+import os
+import sys
+
+def log(string):
+ print >> sys.stderr, string
+
+def error(string):
+ log("ERROR: %s" % string)
+ exit(1)
+
+# Simple class to split output between multiple destinations
+class tee:
+ def __init__(self, *files):
+ self.files = files
+
+ def write(self, string):
+ for file in self.files:
+ file.write(string)
+
+class OutputTee:
+ def __init__(self):
+ self._original_stdout = None
+ self._original_stderr = None
+ self._files_for_output = []
+
+ def add_log(self, path):
+ log_file = self._open_log_file(path)
+ self._files_for_output.append(log_file)
+ self._tee_outputs_to_files(self._files_for_output)
+ return log_file
+
+ def remove_log(self, log_file):
+ self._files_for_output.remove(log_file)
+ self._tee_outputs_to_files(self._files_for_output)
+ log_file.close()
+
+ @staticmethod
+ def _open_log_file(log_path):
+ (log_directory, log_name) = os.path.split(log_path)
+ if log_directory and not os.path.exists(log_directory):
+ os.makedirs(log_directory)
+ return open(log_path, 'a+')
+
+ def _tee_outputs_to_files(self, files):
+ if not self._original_stdout:
+ self._original_stdout = sys.stdout
+ self._original_stderr = sys.stderr
+ if files and len(files):
+ sys.stdout = tee(self._original_stdout, *files)
+ sys.stderr = tee(self._original_stderr, *files)
+ else:
+ sys.stdout = self._original_stdout
+ sys.stderr = self._original_stderr
diff --git a/WebKitTools/Scripts/modules/webkit_logging_unittest.py b/WebKitTools/Scripts/modules/webkit_logging_unittest.py
new file mode 100644
index 0000000..cbeaa4b
--- /dev/null
+++ b/WebKitTools/Scripts/modules/webkit_logging_unittest.py
@@ -0,0 +1,61 @@
+# Copyright (C) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import os
+import subprocess
+import StringIO
+import tempfile
+import unittest
+
+from modules.executive import ScriptError
+from modules.webkit_logging import *
+
+class LoggingTest(unittest.TestCase):
+
+ def assert_log_equals(self, log_input, expected_output):
+ original_stderr = sys.stderr
+ test_stderr = StringIO.StringIO()
+ sys.stderr = test_stderr
+
+ try:
+ log(log_input)
+ actual_output = test_stderr.getvalue()
+ finally:
+ original_stderr = original_stderr
+
+ self.assertEquals(actual_output, expected_output, "log(\"%s\") expected: %s actual: %s" % (log_input, expected_output, actual_output))
+
+ def test_log(self):
+ self.assert_log_equals("test", "test\n")
+
+ # Test that log() does not throw an exception when passed an object instead of a string.
+ self.assert_log_equals(ScriptError(message="ScriptError"), "ScriptError\n")
+
+
+if __name__ == '__main__':
+ unittest.main()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list