Changeset 276762 in webkit
- Timestamp:
- Apr 29, 2021, 2:45:20 AM (4 years ago)
- Location:
- trunk/Tools
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r276744 r276762 1 2021-04-29 Sam Sneddon <gsnedders@apple.com> 2 3 Make sure webkitpy tests pass on Linux and on more Python versions 4 https://bugs.webkit.org/show_bug.cgi?id=225157 5 6 Reviewed by Jonathan Bedard. 7 8 This gets us passing the webkitpy tests, run under pytest, on Linux, 9 under Python 2.7, 3.6, 3.7, 3.8, 3.9, and alpha 3.10. 10 11 * Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py: 12 Conditionally install setuptools 56 on Python 3, keep setuptools 13 44.1.1 on Python 2. (44.1.1 is the last release supporting Python 2, 14 but due to removals doesn't install on Python 3.10.) 15 * Scripts/webkitpy/browserperfdash/browserperfdash_unittest.py: 16 (FakeBrowserDriver): Implement a FakeBrowserDriver which does nothing. 17 (FakeBrowserDriver.__init__): 18 (FakeBrowserDriver.prepare_env): 19 (FakeBrowserDriver.prepare_initial_env): 20 (FakeBrowserDriver.restore_env): 21 (FakeBrowserDriver.restore_env_after_all_testing): 22 (FakeBrowserDriver.close_browsers): 23 (FakeBrowserDriver.launch_url): 24 (FakeBrowserDriver.launch_webdriver): 25 (BrowserPerfDashRunnerTest.test_can_construct_runner_object_minimum_parameters): 26 Use the FakeBrowserRunner rather than the platform/browser 27 default. (This fixes this test on Linux when no minibrowser-gtk is 28 available.) 29 * Scripts/webkitpy/common/checkout/scm/scm_unittest.py: 30 (GitTest.setUp): Set user.name/user.email to ensure they're set. 31 (GitSVNTest._setup_git_checkout): Set user.name/user.email to ensure 32 they're set. 33 * Scripts/webkitpy/common/net/credentials.py: Conditionally import 34 keyring; the rest of the code already supports keyring being 35 None. (keyring doesn't have any release supporting both Python 2 and 36 3.10, but updating keyring pulls in new dependencies and is left as 37 future work.) 38 * Scripts/webkitpy/common/prettypatch_unittest.py: 39 (PrettyPatchTest.check_ruby): Also check Ruby version. 40 (test_pretty_diff_encodings): Explicitly skip; don't just return. 41 (test_pretty_print_empty_string): Explicitly skip; don't just return. 42 * Scripts/webkitpy/common/system/logtesting.py: 43 (TestLogStream.write): Python 3.6's logging appears to put new lines 44 following a message in a new message, which breaks many tests. 45 * Scripts/webkitpy/pytest.ini: Broaden ignored warnings. 46 * Scripts/webkitpy/results/upload_unittest.py: 47 (UploadTest.normalize): collections -> collections.abc for Py3.10 48 * Scripts/webkitpy/xcode/simulated_device.py: 49 (SimulatedDeviceManager._create_device_with_runtime): Use modern 50 plistlib API. 51 (SimulatedDevice.state): Use modern plistlib API. 52 1 53 2021-04-28 Devin Rousso <drousso@apple.com> 2 54 -
trunk/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/__init__.py
r275353 r276762 43 43 if sys.version_info > (3, 0): 44 44 AutoInstall.register(Package('mock', Version(4))) 45 AutoInstall.register(Package('setuptools', Version(56, 0, 0))) 45 46 else: 46 47 AutoInstall.register(Package('mock', Version(3, 0, 5))) 48 AutoInstall.register(Package('setuptools', Version(44, 1, 1))) 47 49 if platform.system() == 'Windows': 48 50 AutoInstall.register(Package('win_inet_pton', Version(1, 1, 0), pypi_name='win-inet-pton')) … … 58 60 AutoInstall.register(Package('pyparsing', Version(2, 4, 7))) 59 61 AutoInstall.register(Package('requests', Version(2, 24))) 60 AutoInstall.register(Package('setuptools', Version(44, 1, 1)))61 62 AutoInstall.register(Package('setuptools_scm', Version(5, 0, 2), pypi_name='setuptools-scm')) 62 63 AutoInstall.register(Package('socks', Version(1, 7, 1), pypi_name='PySocks')) -
trunk/Tools/Scripts/webkitpy/browserperfdash/browserperfdash_unittest.py
r239522 r276762 28 28 import os 29 29 30 from webkitpy.benchmark_runner.run_benchmark import default_browser, default_platform, benchmark_runner_subclasses31 30 from webkitpy.benchmark_runner.benchmark_runner import BenchmarkRunner 32 from webkitpy.benchmark_runner.webserver_benchmark_runner import WebServerBenchmarkRunner 33 from webkitpy.benchmark_runner.webdriver_benchmark_runner import WebDriverBenchmarkRunner 34 from webkitpy.benchmark_runner.browser_driver.browser_driver_factory import BrowserDriverFactory 31 from webkitpy.benchmark_runner.browser_driver.browser_driver import BrowserDriver 32 from webkitpy.benchmark_runner.browser_driver.browser_driver_factory import ( 33 BrowserDriverFactory, 34 ) 35 from webkitpy.benchmark_runner.run_benchmark import ( 36 benchmark_runner_subclasses, 37 ) 35 38 36 39 37 40 _log = logging.getLogger(__name__) 41 42 43 class FakeBrowserDriver(BrowserDriver): 44 browser_name = None 45 process_search_list = [] 46 platform = "fake" 47 48 def __init__(self): 49 self.process_name = "fake/process" 50 51 def prepare_env(self, config): 52 pass 53 54 def prepare_initial_env(self, config): 55 pass 56 57 def restore_env(self): 58 pass 59 60 def restore_env_after_all_testing(self): 61 pass 62 63 def close_browsers(self): 64 pass 65 66 def launch_url(self, url, options, browser_build_path, browser_path): 67 pass 68 69 def launch_webdriver(self, url, driver): 70 pass 71 72 73 BrowserDriverFactory.add_browser_driver("fake", None, FakeBrowserDriver) 38 74 39 75 … … 61 97 plan_list = BenchmarkRunner.available_plans() 62 98 build_dir = os.path.abspath(os.curdir) 63 runner = FakeBenchmarkRunner(plan_list[0], False, 1, build_dir, "/tmp/testOutput.txt", default_platform(), default_browser(), None) 99 runner = FakeBenchmarkRunner( 100 plan_list[0], False, 1, build_dir, "/tmp/testOutput.txt", "fake", None, None 101 ) 64 102 self.assertTrue(runner.execute()) -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py
r276436 r276762 1023 1023 1024 1024 os.chdir(self.untracking_checkout_path) 1025 run_command(['git', 'config', 'user.name', 'scm_unittest']) 1026 run_command(['git', 'config', 'user.email', 'scm_unittest@example.com']) 1025 1027 write_into_file_at_path('foo_file', 'foo') 1026 1028 run_command(['git', 'add', 'foo_file']) … … 1033 1035 run_command(['git', 'clone', '--quiet', self.untracking_checkout_path, self.tracking_git_checkout_path]) 1034 1036 os.chdir(self.tracking_git_checkout_path) 1037 run_command(['git', 'config', 'user.name', 'scm_unittest']) 1038 run_command(['git', 'config', 'user.email', 'scm_unittest@example.com']) 1035 1039 self.tracking_scm = detect_scm_system(self.tracking_git_checkout_path) 1036 1040 … … 1175 1179 run_silent(['git', 'svn', 'clone', '-T', 'trunk', '--prefix', '', self.svn_repo_url, self.git_checkout_path]) 1176 1180 os.chdir(self.git_checkout_path) 1181 run_command(['git', 'config', 'user.name', 'scm_unittest']) 1182 run_command(['git', 'config', 'user.email', 'scm_unittest@example.com']) 1177 1183 run_silent(['git', 'branch', '-m', 'trunk']) 1178 1184 -
trunk/Tools/Scripts/webkitpy/common/net/credentials.py
r271506 r276762 42 42 43 43 with OutputCapture(): 44 import keyring 44 try: 45 import keyring 46 except ImportError: 47 keyring = None 45 48 46 49 _log = logging.getLogger(__name__) -
trunk/Tools/Scripts/webkitpy/common/prettypatch_unittest.py
r251955 r276762 30 30 import sys 31 31 import unittest 32 from distutils.version import StrictVersion 32 33 33 34 from webkitpy.common.system.executive import Executive … … 39 40 executive = Executive() 40 41 try: 41 result = executive.run_command(['ruby', '- -version'])42 result = executive.run_command(['ruby', '-e', 'print(RUBY_VERSION)']) 42 43 except OSError as e: 43 44 return False 44 return True 45 # PrettyPatch relies on WEBrick, which was removed from the Ruby stdlib in 3 46 return StrictVersion(result) < StrictVersion("3.0.0") 45 47 46 48 _diff_with_multiple_encodings = """ … … 69 71 def test_pretty_diff_encodings(self): 70 72 if not self.check_ruby(): 73 self.skipTest("no/unsupported Ruby") 71 74 return 72 75 73 76 if sys.platform.startswith('win'): 74 # FIXME: disabled due to https://bugs.webkit.org/show_bug.cgi?id=9319277 self.skipTest("FIXME: disabled due to https://bugs.webkit.org/show_bug.cgi?id=93192") 75 78 return 76 79 … … 82 85 def test_pretty_print_empty_string(self): 83 86 if not self.check_ruby(): 87 self.skipTest("no/unsupported Ruby") 84 88 return 85 89 -
trunk/Tools/Scripts/webkitpy/common/system/logtesting.py
r174136 r276762 62 62 # http://docs.python.org/library/logging.html#module-logging.handlers 63 63 def write(self, message): 64 self.messages.append(message) 64 if message == "\n" and self.messages: 65 self.messages[-1] += "\n" 66 else: 67 self.messages.append(message) 65 68 66 69 def flush(self): -
trunk/Tools/Scripts/webkitpy/pytest.ini
r276512 r276762 9 9 ignore:The 'warn' method is deprecated, use 'warning' instead:DeprecationWarning 10 10 ignore:cannot collect test class 'Test[^']*' because it has a __init__ constructor:pytest.PytestCollectionWarning 11 ignore:the imp module is deprecated in favour of importlib ; see the module's documentation for alternative uses:DeprecationWarning12 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:DeprecationWarning11 ignore:the imp module is deprecated in favour of importlib.*:DeprecationWarning 12 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 13 13 ignore:The readPlist function is deprecated, use load\(\) instead:DeprecationWarning 14 14 ignore:inspect.getargspec\(\) is deprecated since Python 3.0, use inspect.signature\(\) or inspect.getfullargspec\(\):DeprecationWarning 15 ignore:The distutils package is deprecated.*:DeprecationWarning 16 ignore:ssl module. PROTOCOL_TLS is deprecated.*:DeprecationWarning 17 ignore:AutoInstall.find_spec() not found; falling back to find_module():ImportWarning -
trunk/Tools/Scripts/webkitpy/results/upload_unittest.py
r265574 r276762 30 30 import unittest 31 31 32 try: 33 from collections.abc import Iterable, Mapping 34 except ImportError: 35 from collections import Iterable, Mapping 36 32 37 from webkitpy.results.upload import Upload 33 38 from webkitpy.thirdparty import mock … … 56 61 if isinstance(data, basestring): 57 62 return str(data) 58 elif isinstance(data, collections.Mapping):63 elif isinstance(data, Mapping): 59 64 return dict(map(UploadTest.normalize, data.items())) 60 elif isinstance(data, collections.Iterable):65 elif isinstance(data, Iterable): 61 66 return type(data)(map(UploadTest.normalize, data)) 62 67 return data -
trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py
r276735 r276762 24 24 import json 25 25 import logging 26 import plistlib27 26 import re 28 27 import time … … 35 34 from webkitpy.port.device import Device 36 35 from webkitpy.xcode.device_type import DeviceType 36 37 try: 38 from plistlib import load as readPlist 39 except ImportError: 40 from plistlib import readPlist 37 41 38 42 _log = logging.getLogger(__name__) … … 107 111 # Find device type. If we can't parse the device type, ignore this device. 108 112 try: 109 device_type_string = SimulatedDeviceManager._device_identifier_to_name[ plistlib.readPlist(host.filesystem.open_binary_file_for_reading(device_plist))['deviceType']]113 device_type_string = SimulatedDeviceManager._device_identifier_to_name[readPlist(host.filesystem.open_binary_file_for_reading(device_plist))['deviceType']] 110 114 device_type = DeviceType.from_string(device_type_string, runtime.version) 111 115 assert device_type.software_variant == runtime.os_variant … … 558 562 559 563 device_plist = self.filesystem.expanduser(self.filesystem.join(SimulatedDeviceManager.simulator_device_path, self.udid, 'device.plist')) 560 self._state = int( plistlib.readPlist(self.filesystem.open_binary_file_for_reading(device_plist))['state'])564 self._state = int(readPlist(self.filesystem.open_binary_file_for_reading(device_plist))['state']) 561 565 self._last_updated_state = time.time() 562 566 return self._state
Note:
See TracChangeset
for help on using the changeset viewer.