[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
aroben at apple.com
aroben at apple.com
Wed Dec 22 13:39:53 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit ba3c7eeabecf2fca0488f13f03f19b39b6c5e81d
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 22 20:44:10 2010 +0000
Make test-webkitpy test WebKit2's scripts
These scripts can't be in WebKitTools due to limitations of Apple's
build process. But that doesn't mean we can't test them!
Fixes <http://webkit.org/b/46297> test-webkitpy should test code in
WebKit2/Scripts
Reviewed by Adam Barth.
* Scripts/test-webkitpy:
(_clean_packages_with_test): Renamed from _clean_webkitpy_with_test.
Now takes an external_package_paths parameter and cleans both webkitpy
and any external packages.
(init): Added an external_package_paths parameter which we pass along
to _clean_packages_with_test.
(top level): Add WebKit2/Scripts/webkit2 as our only external package
and pass it along to init and Tester.run_tests.
* Scripts/webkitpy/test/main.py:
(Tester.run_tests): Added an optional external_package_paths
parameter. We modify sys.path so that the external packages can be
imported, and search for unittest files inside all external packages
in addition to inside webkitpy.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68080 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 153d887..0ae738d 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,30 @@
+2010-09-22 Adam Roben <aroben at apple.com>
+
+ Make test-webkitpy test WebKit2's scripts
+
+ These scripts can't be in WebKitTools due to limitations of Apple's
+ build process. But that doesn't mean we can't test them!
+
+ Fixes <http://webkit.org/b/46297> test-webkitpy should test code in
+ WebKit2/Scripts
+
+ Reviewed by Adam Barth.
+
+ * Scripts/test-webkitpy:
+ (_clean_packages_with_test): Renamed from _clean_webkitpy_with_test.
+ Now takes an external_package_paths parameter and cleans both webkitpy
+ and any external packages.
+ (init): Added an external_package_paths parameter which we pass along
+ to _clean_packages_with_test.
+ (top level): Add WebKit2/Scripts/webkit2 as our only external package
+ and pass it along to init and Tester.run_tests.
+
+ * Scripts/webkitpy/test/main.py:
+ (Tester.run_tests): Added an optional external_package_paths
+ parameter. We modify sys.path so that the external packages can be
+ imported, and search for unittest files inside all external packages
+ in addition to inside webkitpy.
+
2010-09-22 Dirk Pranke <dpranke at chromium.org>
Reviewed by Tony Chang.
diff --git a/WebKitTools/Scripts/test-webkitpy b/WebKitTools/Scripts/test-webkitpy
index e35c6e6..be7e870 100755
--- a/WebKitTools/Scripts/test-webkitpy
+++ b/WebKitTools/Scripts/test-webkitpy
@@ -137,8 +137,9 @@ def _clean_pyc_files(dir_to_clean, paths_not_to_log):
# As a substitute for a unit test, this method tests _clean_pyc_files()
# in addition to calling it. We chose not to use the unittest module
# because _clean_pyc_files() is called only once and is not used elsewhere.
-def _clean_webkitpy_with_test():
+def _clean_packages_with_test(external_package_paths):
webkitpy_dir = os.path.join(os.path.dirname(__file__), "webkitpy")
+ package_paths = [webkitpy_dir] + external_package_paths
# The test .pyc file is--
# webkitpy/python24/TEMP_test-webkitpy_test_pyc_file.pyc.
@@ -156,13 +157,14 @@ def _clean_webkitpy_with_test():
if not os.path.exists(test_path):
raise Exception("Test .pyc file not created: %s" % test_path)
- _clean_pyc_files(webkitpy_dir, [test_path])
+ for path in package_paths:
+ _clean_pyc_files(path, [test_path])
if os.path.exists(test_path):
raise Exception("Test .pyc file not deleted: %s" % test_path)
-def init(command_args):
+def init(command_args, external_package_paths):
"""Execute code prior to importing from webkitpy.unittests.
Args:
@@ -186,8 +188,8 @@ def init(command_args):
configure_logging(is_verbose_logging)
_log.debug("Verbose WebKit logging enabled.")
- # We clean orphaned *.pyc files from webkitpy prior to importing from
- # webkitpy to make sure that no import statements falsely succeed.
+ # We clean orphaned *.pyc files from the packages prior to importing from
+ # them to make sure that no import statements falsely succeed.
# This helps to check that import statements have been updated correctly
# after any file moves. Otherwise, incorrect import statements can
# be masked.
@@ -208,7 +210,7 @@ def init(command_args):
#
# Deleting the orphaned .pyc file prior to importing, however, would
# cause an ImportError to occur on import as desired.
- _clean_webkitpy_with_test()
+ _clean_packages_with_test(external_package_paths)
import webkitpy.python24.versioning as versioning
@@ -227,7 +229,8 @@ def init(command_args):
if __name__ == "__main__":
- init(sys.argv[1:])
+ external_package_paths = [os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'WebKit2', 'Scripts', 'webkit2')]
+ init(sys.argv[1:], external_package_paths)
# We import the unit test code after init() to ensure that any
# Python version warnings are displayed in case an error occurs
@@ -237,4 +240,4 @@ if __name__ == "__main__":
# running the unit tests.
from webkitpy.test.main import Tester
- Tester().run_tests(sys.argv)
+ Tester().run_tests(sys.argv, external_package_paths)
diff --git a/WebKitTools/Scripts/webkitpy/test/main.py b/WebKitTools/Scripts/webkitpy/test/main.py
index daf255f..f2d3d52 100644
--- a/WebKitTools/Scripts/webkitpy/test/main.py
+++ b/WebKitTools/Scripts/webkitpy/test/main.py
@@ -78,7 +78,7 @@ class Tester(object):
return modules
- def run_tests(self, sys_argv):
+ def run_tests(self, sys_argv, external_package_paths=None):
"""Run the unit tests in all *_unittest.py modules in webkitpy.
This method excludes "webkitpy.common.checkout.scm_unittest" unless
@@ -88,6 +88,11 @@ class Tester(object):
sys_argv: A reference to sys.argv.
"""
+ if external_package_paths is None:
+ external_package_paths = []
+ else:
+ sys.path.extend(set(os.path.dirname(path) for path in external_package_paths))
+
if len(sys_argv) > 1 and not sys_argv[-1].startswith("-"):
# Then explicit modules or test names were provided, which
# the unittest module is equipped to handle.
@@ -97,9 +102,9 @@ class Tester(object):
# Otherwise, auto-detect all unit tests.
webkitpy_dir = os.path.dirname(webkitpy.__file__)
- unittest_paths = self._find_unittest_files(webkitpy_dir)
- modules = self._modules_from_paths(webkitpy_dir, unittest_paths)
+ for path in [webkitpy_dir] + external_package_paths:
+ modules.extend(self._modules_from_paths(path, self._find_unittest_files(path)))
modules.sort()
# This is a sanity check to ensure that the unit-test discovery
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list