Diff
Modified: trunk/Tools/ChangeLog (276761 => 276762)
--- trunk/Tools/ChangeLog 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/ChangeLog 2021-04-29 09:45:20 UTC (rev 276762)
@@ -1,3 +1,55 @@
+2021-04-29 Sam Sneddon <[email protected]>
+
+ Make sure webkitpy tests pass on Linux and on more Python versions
+ https://bugs.webkit.org/show_bug.cgi?id=225157
+
+ Reviewed by Jonathan Bedard.
+
+ This gets us passing the webkitpy tests, run under pytest, on Linux,
+ under Python 2.7, 3.6, 3.7, 3.8, 3.9, and alpha 3.10.
+
+ * Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py:
+ Conditionally install setuptools 56 on Python 3, keep setuptools
+ 44.1.1 on Python 2. (44.1.1 is the last release supporting Python 2,
+ but due to removals doesn't install on Python 3.10.)
+ * Scripts/webkitpy/browserperfdash/browserperfdash_unittest.py:
+ (FakeBrowserDriver): Implement a FakeBrowserDriver which does nothing.
+ (FakeBrowserDriver.__init__):
+ (FakeBrowserDriver.prepare_env):
+ (FakeBrowserDriver.prepare_initial_env):
+ (FakeBrowserDriver.restore_env):
+ (FakeBrowserDriver.restore_env_after_all_testing):
+ (FakeBrowserDriver.close_browsers):
+ (FakeBrowserDriver.launch_url):
+ (FakeBrowserDriver.launch_webdriver):
+ (BrowserPerfDashRunnerTest.test_can_construct_runner_object_minimum_parameters):
+ Use the FakeBrowserRunner rather than the platform/browser
+ default. (This fixes this test on Linux when no minibrowser-gtk is
+ available.)
+ * Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
+ (GitTest.setUp): Set user.name/user.email to ensure they're set.
+ (GitSVNTest._setup_git_checkout): Set user.name/user.email to ensure
+ they're set.
+ * Scripts/webkitpy/common/net/credentials.py: Conditionally import
+ keyring; the rest of the code already supports keyring being
+ None. (keyring doesn't have any release supporting both Python 2 and
+ 3.10, but updating keyring pulls in new dependencies and is left as
+ future work.)
+ * Scripts/webkitpy/common/prettypatch_unittest.py:
+ (PrettyPatchTest.check_ruby): Also check Ruby version.
+ (test_pretty_diff_encodings): Explicitly skip; don't just return.
+ (test_pretty_print_empty_string): Explicitly skip; don't just return.
+ * Scripts/webkitpy/common/system/logtesting.py:
+ (TestLogStream.write): Python 3.6's logging appears to put new lines
+ following a message in a new message, which breaks many tests.
+ * Scripts/webkitpy/pytest.ini: Broaden ignored warnings.
+ * Scripts/webkitpy/results/upload_unittest.py:
+ (UploadTest.normalize): collections -> collections.abc for Py3.10
+ * Scripts/webkitpy/xcode/simulated_device.py:
+ (SimulatedDeviceManager._create_device_with_runtime): Use modern
+ plistlib API.
+ (SimulatedDevice.state): Use modern plistlib API.
+
2021-04-28 Devin Rousso <[email protected]>
experiment with averaging sampling colors across the top of the page as the scroll area background
Modified: trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py (276761 => 276762)
--- trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py 2021-04-29 09:45:20 UTC (rev 276762)
@@ -42,8 +42,10 @@
from webkitcorepy.autoinstall import Package, AutoInstall
if sys.version_info > (3, 0):
AutoInstall.register(Package('mock', Version(4)))
+ AutoInstall.register(Package('setuptools', Version(56, 0, 0)))
else:
AutoInstall.register(Package('mock', Version(3, 0, 5)))
+ AutoInstall.register(Package('setuptools', Version(44, 1, 1)))
if platform.system() == 'Windows':
AutoInstall.register(Package('win_inet_pton', Version(1, 1, 0), pypi_name='win-inet-pton'))
@@ -57,7 +59,6 @@
AutoInstall.register(Package('packaging', Version(20, 4)))
AutoInstall.register(Package('pyparsing', Version(2, 4, 7)))
AutoInstall.register(Package('requests', Version(2, 24)))
-AutoInstall.register(Package('setuptools', Version(44, 1, 1)))
AutoInstall.register(Package('setuptools_scm', Version(5, 0, 2), pypi_name='setuptools-scm'))
AutoInstall.register(Package('socks', Version(1, 7, 1), pypi_name='PySocks'))
AutoInstall.register(Package('six', Version(1, 15, 0)))
Modified: trunk/Tools/Scripts/webkitpy/browserperfdash/browserperfdash_unittest.py (276761 => 276762)
--- trunk/Tools/Scripts/webkitpy/browserperfdash/browserperfdash_unittest.py 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/Scripts/webkitpy/browserperfdash/browserperfdash_unittest.py 2021-04-29 09:45:20 UTC (rev 276762)
@@ -27,16 +27,52 @@
import unittest
import os
-from webkitpy.benchmark_runner.run_benchmark import default_browser, default_platform, benchmark_runner_subclasses
from webkitpy.benchmark_runner.benchmark_runner import BenchmarkRunner
-from webkitpy.benchmark_runner.webserver_benchmark_runner import WebServerBenchmarkRunner
-from webkitpy.benchmark_runner.webdriver_benchmark_runner import WebDriverBenchmarkRunner
-from webkitpy.benchmark_runner.browser_driver.browser_driver_factory import BrowserDriverFactory
+from webkitpy.benchmark_runner.browser_driver.browser_driver import BrowserDriver
+from webkitpy.benchmark_runner.browser_driver.browser_driver_factory import (
+ BrowserDriverFactory,
+)
+from webkitpy.benchmark_runner.run_benchmark import (
+ benchmark_runner_subclasses,
+)
_log = logging.getLogger(__name__)
+class FakeBrowserDriver(BrowserDriver):
+ browser_name = None
+ process_search_list = []
+ platform = "fake"
+
+ def __init__(self):
+ self.process_name = "fake/process"
+
+ def prepare_env(self, config):
+ pass
+
+ def prepare_initial_env(self, config):
+ pass
+
+ def restore_env(self):
+ pass
+
+ def restore_env_after_all_testing(self):
+ pass
+
+ def close_browsers(self):
+ pass
+
+ def launch_url(self, url, options, browser_build_path, browser_path):
+ pass
+
+ def launch_webdriver(self, url, driver):
+ pass
+
+
+BrowserDriverFactory.add_browser_driver("fake", None, FakeBrowserDriver)
+
+
class FakeBenchmarkRunner(BenchmarkRunner):
name = 'fake'
@@ -60,5 +96,7 @@
# This tests that constructing the benchmark_runner object specifying the minimum required paramaters is ok.
plan_list = BenchmarkRunner.available_plans()
build_dir = os.path.abspath(os.curdir)
- runner = FakeBenchmarkRunner(plan_list[0], False, 1, build_dir, "/tmp/testOutput.txt", default_platform(), default_browser(), None)
+ runner = FakeBenchmarkRunner(
+ plan_list[0], False, 1, build_dir, "/tmp/testOutput.txt", "fake", None, None
+ )
self.assertTrue(runner.execute())
Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py (276761 => 276762)
--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py 2021-04-29 09:45:20 UTC (rev 276762)
@@ -1022,6 +1022,8 @@
run_command(['git', 'init', self.untracking_checkout_path])
os.chdir(self.untracking_checkout_path)
+ run_command(['git', 'config', 'user.name', 'scm_unittest'])
+ run_command(['git', 'config', 'user.email', '[email protected]'])
write_into_file_at_path('foo_file', 'foo')
run_command(['git', 'add', 'foo_file'])
write_into_file_at_path('.gitignore', '*.pyc')
@@ -1032,6 +1034,8 @@
self.tracking_git_checkout_path = tempfile.mkdtemp(suffix="git_test_checkout")
run_command(['git', 'clone', '--quiet', self.untracking_checkout_path, self.tracking_git_checkout_path])
os.chdir(self.tracking_git_checkout_path)
+ run_command(['git', 'config', 'user.name', 'scm_unittest'])
+ run_command(['git', 'config', 'user.email', '[email protected]'])
self.tracking_scm = detect_scm_system(self.tracking_git_checkout_path)
def tearDown(self):
@@ -1174,6 +1178,8 @@
# --quiet doesn't make git svn silent, so we use run_silent to redirect output
run_silent(['git', 'svn', 'clone', '-T', 'trunk', '--prefix', '', self.svn_repo_url, self.git_checkout_path])
os.chdir(self.git_checkout_path)
+ run_command(['git', 'config', 'user.name', 'scm_unittest'])
+ run_command(['git', 'config', 'user.email', '[email protected]'])
run_silent(['git', 'branch', '-m', 'trunk'])
def _tear_down_git_checkout(self):
Modified: trunk/Tools/Scripts/webkitpy/common/net/credentials.py (276761 => 276762)
--- trunk/Tools/Scripts/webkitpy/common/net/credentials.py 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/Scripts/webkitpy/common/net/credentials.py 2021-04-29 09:45:20 UTC (rev 276762)
@@ -41,7 +41,10 @@
from webkitpy.common.system.user import User
with OutputCapture():
- import keyring
+ try:
+ import keyring
+ except ImportError:
+ keyring = None
_log = logging.getLogger(__name__)
Modified: trunk/Tools/Scripts/webkitpy/common/prettypatch_unittest.py (276761 => 276762)
--- trunk/Tools/Scripts/webkitpy/common/prettypatch_unittest.py 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/Scripts/webkitpy/common/prettypatch_unittest.py 2021-04-29 09:45:20 UTC (rev 276762)
@@ -29,6 +29,7 @@
import os.path
import sys
import unittest
+from distutils.version import StrictVersion
from webkitpy.common.system.executive import Executive
from webkitpy.common.prettypatch import PrettyPatch
@@ -38,10 +39,11 @@
def check_ruby(self):
executive = Executive()
try:
- result = executive.run_command(['ruby', '--version'])
+ result = executive.run_command(['ruby', '-e', 'print(RUBY_VERSION)'])
except OSError as e:
return False
- return True
+ # PrettyPatch relies on WEBrick, which was removed from the Ruby stdlib in 3
+ return StrictVersion(result) < StrictVersion("3.0.0")
_diff_with_multiple_encodings = """
Index: utf8_test
@@ -68,10 +70,11 @@
def test_pretty_diff_encodings(self):
if not self.check_ruby():
+ self.skipTest("no/unsupported Ruby")
return
if sys.platform.startswith('win'):
- # FIXME: disabled due to https://bugs.webkit.org/show_bug.cgi?id=93192
+ self.skipTest("FIXME: disabled due to https://bugs.webkit.org/show_bug.cgi?id=93192")
return
pretty_patch = PrettyPatch(Executive(), self._webkit_root())
@@ -81,6 +84,7 @@
def test_pretty_print_empty_string(self):
if not self.check_ruby():
+ self.skipTest("no/unsupported Ruby")
return
# Make sure that an empty diff does not hang the process.
Modified: trunk/Tools/Scripts/webkitpy/common/system/logtesting.py (276761 => 276762)
--- trunk/Tools/Scripts/webkitpy/common/system/logtesting.py 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/Scripts/webkitpy/common/system/logtesting.py 2021-04-29 09:45:20 UTC (rev 276762)
@@ -61,7 +61,10 @@
#
# http://docs.python.org/library/logging.html#module-logging.handlers
def write(self, message):
- self.messages.append(message)
+ if message == "\n" and self.messages:
+ self.messages[-1] += "\n"
+ else:
+ self.messages.append(message)
def flush(self):
pass
Modified: trunk/Tools/Scripts/webkitpy/pytest.ini (276761 => 276762)
--- trunk/Tools/Scripts/webkitpy/pytest.ini 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/Scripts/webkitpy/pytest.ini 2021-04-29 09:45:20 UTC (rev 276762)
@@ -8,7 +8,10 @@
ignore:Please use assert.* instead.:DeprecationWarning
ignore:The 'warn' method is deprecated, use 'warning' instead:DeprecationWarning
ignore:cannot collect test class 'Test[^']*' because it has a __init__ constructor:pytest.PytestCollectionWarning
- ignore:the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses:DeprecationWarning
- ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.[0-9]+ it will stop working:DeprecationWarning
+ ignore:the imp module is deprecated in favour of importlib.*:DeprecationWarning
+ ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, ?and in 3.[0-9]+ it will stop working:DeprecationWarning
ignore:The readPlist function is deprecated, use load\(\) instead:DeprecationWarning
ignore:inspect.getargspec\(\) is deprecated since Python 3.0, use inspect.signature\(\) or inspect.getfullargspec\(\):DeprecationWarning
+ ignore:The distutils package is deprecated.*:DeprecationWarning
+ ignore:ssl module. PROTOCOL_TLS is deprecated.*:DeprecationWarning
+ ignore:AutoInstall.find_spec() not found; falling back to find_module():ImportWarning
Modified: trunk/Tools/Scripts/webkitpy/results/upload_unittest.py (276761 => 276762)
--- trunk/Tools/Scripts/webkitpy/results/upload_unittest.py 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/Scripts/webkitpy/results/upload_unittest.py 2021-04-29 09:45:20 UTC (rev 276762)
@@ -29,6 +29,11 @@
import time
import unittest
+try:
+ from collections.abc import Iterable, Mapping
+except ImportError:
+ from collections import Iterable, Mapping
+
from webkitpy.results.upload import Upload
from webkitpy.thirdparty import mock
@@ -55,9 +60,9 @@
def normalize(data):
if isinstance(data, basestring):
return str(data)
- elif isinstance(data, collections.Mapping):
+ elif isinstance(data, Mapping):
return dict(map(UploadTest.normalize, data.items()))
- elif isinstance(data, collections.Iterable):
+ elif isinstance(data, Iterable):
return type(data)(map(UploadTest.normalize, data))
return data
Modified: trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py (276761 => 276762)
--- trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py 2021-04-29 08:39:24 UTC (rev 276761)
+++ trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py 2021-04-29 09:45:20 UTC (rev 276762)
@@ -23,7 +23,6 @@
import atexit
import json
import logging
-import plistlib
import re
import time
@@ -35,6 +34,11 @@
from webkitpy.port.device import Device
from webkitpy.xcode.device_type import DeviceType
+try:
+ from plistlib import load as readPlist
+except ImportError:
+ from plistlib import readPlist
+
_log = logging.getLogger(__name__)
@@ -106,7 +110,7 @@
# Find device type. If we can't parse the device type, ignore this device.
try:
- device_type_string = SimulatedDeviceManager._device_identifier_to_name[plistlib.readPlist(host.filesystem.open_binary_file_for_reading(device_plist))['deviceType']]
+ device_type_string = SimulatedDeviceManager._device_identifier_to_name[readPlist(host.filesystem.open_binary_file_for_reading(device_plist))['deviceType']]
device_type = DeviceType.from_string(device_type_string, runtime.version)
assert device_type.software_variant == runtime.os_variant
except (ValueError, AssertionError):
@@ -557,7 +561,7 @@
return self._state
device_plist = self.filesystem.expanduser(self.filesystem.join(SimulatedDeviceManager.simulator_device_path, self.udid, 'device.plist'))
- self._state = int(plistlib.readPlist(self.filesystem.open_binary_file_for_reading(device_plist))['state'])
+ self._state = int(readPlist(self.filesystem.open_binary_file_for_reading(device_plist))['state'])
self._last_updated_state = time.time()
return self._state