From fdfc24e36a6658ba5903e23c8c5e87e10651bda3 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 12 Jun 2024 22:00:15 +0000 Subject: [PATCH] run tests using python 3.8 This is achieved by duplicating vpython spec in tests directory and changing the python version to 3.8. The reason for this change is that even though depot_tools support 3.11, the entire infra is still on 3.8 so any new 3.8+ feature used in depot_tools may break infra test and it has already happened couple of times. Bug: 346784198 Change-Id: I7dbd0d926da21854abf47af2c2f6edfeec2c5c4d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5625090 Reviewed-by: Josip Sokcevic Auto-Submit: Yiwei Zhang Commit-Queue: Josip Sokcevic --- presubmit_canned_checks.py | 3 +- tests/.vpython3 | 104 +++++++++++++++++++++++++++++++++ tests/gclient_eval_unittest.py | 4 +- tests/presubmit_diff_test.py | 3 +- 4 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 tests/.vpython3 diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 1edc2ac70..b0d13c730 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -8,7 +8,6 @@ import functools import io as _io import os as _os import time -import zoneinfo import metadata.discover import metadata.validate @@ -907,7 +906,7 @@ def CheckChromiumDependencyMetadata(input_api, output_api, file_filter=None): _IGNORE_FREEZE_FOOTER = 'Ignore-Freeze' -_FREEZE_TZ = zoneinfo.ZoneInfo("America/Los_Angeles") +_FREEZE_TZ = datetime.timezone(-datetime.timedelta(hours=8), 'PST') _FREEZE_START = datetime.datetime(2023, 12, 15, 0, 0, tzinfo=_FREEZE_TZ) _FREEZE_END = datetime.datetime(2024, 1, 2, 0, 0, tzinfo=_FREEZE_TZ) diff --git a/tests/.vpython3 b/tests/.vpython3 new file mode 100644 index 000000000..305788e28 --- /dev/null +++ b/tests/.vpython3 @@ -0,0 +1,104 @@ +# TODO - crbug/346784198: Delete this file once the entire infra is on 3.11 so +# that the vpython spec under the root directory will be used. + +python_version: "3.8" +# The default set of platforms vpython checks for does not yet include mac-arm64. +# Setting `verify_pep425_tag` to the list of platforms we explicitly must support +# allows us to ensure that vpython specs stay mac-arm64-friendly +verify_pep425_tag: [ + {python: "cp38", abi: "cp38", platform: "manylinux1_x86_64"}, + {python: "cp38", abi: "cp38", platform: "linux_arm64"}, + {python: "cp38", abi: "cp38", platform: "macosx_10_10_intel"}, + {python: "cp38", abi: "cp38", platform: "macosx_11_0_arm64"}, + {python: "cp38", abi: "cp38", platform: "win32"}, + {python: "cp38", abi: "cp38", platform: "win_amd64"} +] + +# Used by: +# auth.py +# gerrit_util.py +# git_cl.py +# my_activity.py +# TODO(crbug.com/1002153): Add ninjalog_uploader.py +wheel: < + name: "infra/python/wheels/httplib2-py3" + version: "version:0.13.1" +> +wheel: < + name: "infra/python/wheels/six-py2_py3" + version: "version:1.10.0" +> + +# Used by: +# presubmit_support.py +wheel: < + name: "infra/python/wheels/requests-py3" + version: "version:2.31.0" +> +wheel: < + name: "infra/python/wheels/charset_normalizer-py3" + version: "version:2.0.4" +> +wheel: < + name: "infra/python/wheels/urllib3-py2_py3" + version: "version:1.26.6" +> +wheel: < + name: "infra/python/wheels/idna-py2_py3" + version: "version:2.8" +> +wheel: < + name: "infra/python/wheels/brotli/${vpython_platform}" + version: "version:1.0.9" +> + +# Used by: +# presubmit_canned_checks.py (via zoneinfo) +wheel: < + name: "infra/python/wheels/tzdata-py2_py3" + version: "version:2023.4" +> + +# Used by: +# my_activity.py +wheel: < + name: "infra/python/wheels/python-dateutil-py2_py3" + version: "version:2.7.3" +> + +# May be required to talk to 3P servers. +# Fixes https://crbug.com/1255921 +wheel: < + name: "infra/python/wheels/certifi-py2_py3" + version: "version:2021.5.30" +> + +# Used by: +# autoninja.py +wheel: < + name: "infra/python/wheels/google-auth-py3" + version: "version:2.16.2" +> +wheel: < + name: "infra/python/wheels/cachetools-py3" + version: "version:4.2.2" +> +wheel: < + name: "infra/python/wheels/pyasn1_modules-py2_py3" + version: "version:0.2.8" +> +wheel: < + name: "infra/python/wheels/rsa-py3" + version: "version:4.7.2" +> +wheel: < + name: "infra/python/wheels/pyasn1-py2_py3" + version: "version:0.4.8" +> + +# Used by: +# tests/autoninja_test.py +wheel: < + name: "infra/python/wheels/parameterized-py2_py3" + version: "version:0.8.1" +> diff --git a/tests/gclient_eval_unittest.py b/tests/gclient_eval_unittest.py index 647ec1a43..03decdf30 100755 --- a/tests/gclient_eval_unittest.py +++ b/tests/gclient_eval_unittest.py @@ -93,8 +93,8 @@ class GClientEvalTest(unittest.TestCase): def test_not_whitelisted(self): with self.assertRaises(ValueError) as cm: gclient_eval._gclient_eval('[x for x in [1, 2, 3]]') - self.assertIn('unexpected AST node: