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 <sokcevic@chromium.org>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
changes/90/5625090/5
Yiwei Zhang 11 months ago committed by LUCI CQ
parent c0883c509e
commit fdfc24e36a

@ -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)

@ -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"
>

@ -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: <ast.ListComp object',
str(cm.exception))
self.assertIn('unexpected AST node', str(cm.exception))
self.assertIn('ast.ListComp object', str(cm.exception))
def test_dict_ordered(self):
for test_case in itertools.permutations(range(4)):

@ -8,6 +8,7 @@ import os
import sys
import tempfile
import unittest
from typing import Dict, List
from unittest import mock
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@ -51,7 +52,7 @@ class PresubmitDiffTest(unittest.TestCase):
def tearDown(self):
gclient_utils.rmtree(self.root)
def _test_create_diffs(self, files: list[str], expected: dict[str, str]):
def _test_create_diffs(self, files: List[str], expected: Dict[str, str]):
actual = presubmit_diff.create_diffs("host", "repo", "ref", self.root,
files)
self.assertEqual(actual.keys(), expected.keys())

Loading…
Cancel
Save