[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
cjerdonek at webkit.org
cjerdonek at webkit.org
Wed Mar 17 18:38:35 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 26274cca2dc8672ca70537ef208c2a3b2d4502ab
Author: cjerdonek at webkit.org <cjerdonek at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Mar 13 23:48:20 2010 +0000
Changed test-webkitpy so that messages logged as a side-effect
of unit-testing code do not get displayed to the screen. These
messages clutter up the unit test results if not filtered out.
Reviewed by Adam Barth.
https://bugs.webkit.org/show_bug.cgi?id=35835
* Scripts/test-webkitpy:
- Adjusted the configure_logging() method to filter out any
log messages from webkitpy.
- Also added an INFO message stating that most console logging
is getting suppressed.
* Scripts/webkitpy/init/versioning.py:
- Added a log parameter to the check_version() method.
* Scripts/webkitpy/init/versioning_unittest.py:
- Qualified a call to check_version() with the parameter names.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55971 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 10b9d52..432ca37 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -2,6 +2,28 @@
Reviewed by Adam Barth.
+ Changed test-webkitpy so that messages logged as a side-effect
+ of unit-testing code do not get displayed to the screen. These
+ messages clutter up the unit test results if not filtered out.
+
+ https://bugs.webkit.org/show_bug.cgi?id=35835
+
+ * Scripts/test-webkitpy:
+ - Adjusted the configure_logging() method to filter out any
+ log messages from webkitpy.
+ - Also added an INFO message stating that most console logging
+ is getting suppressed.
+
+ * Scripts/webkitpy/init/versioning.py:
+ - Added a log parameter to the check_version() method.
+
+ * Scripts/webkitpy/init/versioning_unittest.py:
+ - Qualified a call to check_version() with the parameter names.
+
+2010-03-13 Chris Jerdonek <cjerdonek at webkit.org>
+
+ Reviewed by Adam Barth.
+
The test-webkitpy script now warns the user if the script is
being run using a Python version different from the minimum
version the webkitpy package was meant to support.
diff --git a/WebKitTools/Scripts/test-webkitpy b/WebKitTools/Scripts/test-webkitpy
index 71b6dec..615e1c2 100755
--- a/WebKitTools/Scripts/test-webkitpy
+++ b/WebKitTools/Scripts/test-webkitpy
@@ -38,7 +38,12 @@ _log = logging.getLogger("test-webkitpy")
def configure_logging():
- """Configure the root logger to log info messages and above."""
+ """Configure the root logger.
+
+ Configure the root logger not to log any messages from webkitpy,
+ and to log all other messages that are INFO and above.
+
+ """
handler = logging.StreamHandler(sys.stderr)
formatter = logging.Formatter("[%(levelname)s] %(name)s: %(message)s")
handler.setFormatter(formatter)
@@ -47,12 +52,34 @@ def configure_logging():
logger.setLevel(logging.INFO)
logger.addHandler(handler)
+ # Filter out most webkitpy messages.
+ #
+ # Messages can be selectively re-enabled for this script by updating
+ # this method accordingly.
+ def filter(record):
+ """Filter out autoinstall and non-third-party webkitpy messages."""
+ # FIXME: Enable the logging of autoinstall messages once
+ # autoinstall is adjusted. Currently, autoinstall logs
+ # INFO messages when importing already-downloaded packages,
+ # which is too verbose.
+ if record.name.startswith("webkitpy"):
+ return False
+ return True
+
+ testing_filter = logging.Filter()
+ testing_filter.filter = filter
+
+ # Display a message so developers are not mystified as to why
+ # logging does not work in the unit tests.
+ _log.info("Suppressing most webkitpy logging while running unit tests.")
+ handler.addFilter(testing_filter)
+
def init():
"""Execute code prior to importing from webkitpy.unittests."""
configure_logging()
- versioning.check_version()
+ versioning.check_version(log=_log)
(comparison, current_version, minimum_version) = \
versioning.compare_version()
diff --git a/WebKitTools/Scripts/webkitpy/init/versioning.py b/WebKitTools/Scripts/webkitpy/init/versioning.py
index 4eb008e..1413b5e 100644
--- a/WebKitTools/Scripts/webkitpy/init/versioning.py
+++ b/WebKitTools/Scripts/webkitpy/init/versioning.py
@@ -97,13 +97,15 @@ def compare_version(sysmodule=None, target_version=None):
# FIXME: Add a logging level parameter to allow the version message
# to be logged at levels other than WARNING, for example CRITICAL.
-def check_version(sysmodule=None, target_version=None):
+def check_version(log=None, sysmodule=None, target_version=None):
"""Check the current Python version against a target version.
Logs a warning message if the current version is less than the
target version.
Args:
+ log: A logging.logger instance to use when logging the version warning.
+ Defaults to the logger of this module.
sysmodule: See the compare_version() docstring.
target_version: See the compare_version() docstring.
@@ -112,6 +114,9 @@ def check_version(sysmodule=None, target_version=None):
or equal to the target version.
"""
+ if log is None:
+ log = _log
+
(comparison, current_version, target_version) = \
compare_version(sysmodule, target_version)
@@ -122,5 +127,5 @@ def check_version(sysmodule=None, target_version=None):
message = ("WebKit Python scripts do not support your current Python "
"version (%s). The minimum supported version is %s."
% (current_version, target_version))
- _log.warn(message)
+ log.warn(message)
return False
diff --git a/WebKitTools/Scripts/webkitpy/init/versioning_unittest.py b/WebKitTools/Scripts/webkitpy/init/versioning_unittest.py
index 5ab2def..aad1f72 100644
--- a/WebKitTools/Scripts/webkitpy/init/versioning_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/init/versioning_unittest.py
@@ -112,7 +112,7 @@ class CheckVersionTest(unittest.TestCase):
def _check_version(self, minimum_version):
"""Call check_version()."""
mock_sys = MockSys("2.5.3")
- return check_version(mock_sys, minimum_version)
+ return check_version(sysmodule=mock_sys, target_version=minimum_version)
def test_true_return_value(self):
"""Test the configured minimum version that webkitpy supports."""
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list