Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.13 #49970

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/affected_tests.yml
parameters:
checkoutCommit: 'HEAD^1'
Expand All @@ -75,7 +75,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/checkout.yml
- script: |
set -eux -o pipefail
Expand All @@ -96,7 +96,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/install_fonts.yml
- template: tools/ci/azure/install_certs.yml
Expand Down Expand Up @@ -135,15 +135,15 @@ jobs:
toxenv: py38

- job: tools_unittest_mac_py311
displayName: 'tools/ unittests: macOS + Python 3.12'
displayName: 'tools/ unittests: macOS + Python 3.13'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.tools_unittest']
pool:
vmImage: 'macOS-14'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
parameters:
Expand All @@ -167,15 +167,15 @@ jobs:
toxenv: py38

- job: wptrunner_unittest_mac_py311
displayName: 'tools/wptrunner/ unittests: macOS + Python 3.12'
displayName: 'tools/wptrunner/ unittests: macOS + Python 3.13'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.wptrunner_unittest']
pool:
vmImage: 'macOS-14'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
parameters:
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
toxenv: py38

- job: wpt_integration_mac_py311
displayName: 'tools/wpt/ tests: macOS + Python 3.12'
displayName: 'tools/wpt/ tests: macOS + Python 3.13'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.wpt_integration']
pool:
Expand All @@ -212,7 +212,7 @@ jobs:
# full checkout required
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/install_chrome.yml
- template: tools/ci/azure/install_firefox.yml
- template: tools/ci/azure/update_hosts.yml
Expand Down Expand Up @@ -242,15 +242,15 @@ jobs:
toxenv: py38

- job: tools_unittest_win_py311
displayName: 'tools/ unittests: Windows + Python 3.12'
displayName: 'tools/ unittests: Windows + Python 3.13'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.tools_unittest']
pool:
vmImage: 'windows-2019'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
addToPath: false
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
Expand All @@ -276,15 +276,15 @@ jobs:
toxenv: py38

- job: wptrunner_unittest_win_py311
displayName: 'tools/wptrunner/ unittests: Windows + Python 3.12'
displayName: 'tools/wptrunner/ unittests: Windows + Python 3.13'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.wptrunner_unittest']
pool:
vmImage: 'windows-2019'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
addToPath: false
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
toxenv: py38

- job: wpt_integration_win_py311
displayName: 'tools/wpt/ tests: Windows + Python 3.12'
displayName: 'tools/wpt/ tests: Windows + Python 3.13'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.wpt_integration']
pool:
Expand All @@ -324,7 +324,7 @@ jobs:
# full checkout required
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
# currently just using the outdated Chrome/Firefox on the VM rather than
# figuring out how to install Chrome Dev channel on Windows
# - template: tools/ci/azure/install_chrome.yml
Expand All @@ -350,7 +350,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/system_info.yml
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/install_certs.yml
Expand Down Expand Up @@ -386,7 +386,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/system_info.yml
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/install_certs.yml
Expand Down Expand Up @@ -422,7 +422,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/install_certs.yml
- template: tools/ci/azure/install_edge.yml
Expand Down Expand Up @@ -456,7 +456,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
versionSpec: '3.13'
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/install_certs.yml
- template: tools/ci/azure/color_profile.yml
Expand Down
28 changes: 14 additions & 14 deletions tools/ci/tc/tasks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ components:
- python3.8-dev
- python3.8-venv

tox-python3_12:
tox-python3_13:
env:
TOXENV: py312
TOXENV: py313
PY_COLORS: "0"
install:
- python3.12
- python3.12-dev
- python3.12-venv
- python3.13
- python3.13-dev
- python3.13-venv
tests-affected:
options:
browser:
Expand Down Expand Up @@ -451,13 +451,13 @@ tasks:
run-job:
- tools_unittest

- tools/ unittests (Python 3.12):
- tools/ unittests (Python 3.13):
description: >-
Unit tests for tools running under Python 3.12, excluding wptrunner
Unit tests for tools running under Python 3.13, excluding wptrunner
use:
- wpt-base
- trigger-pr
- tox-python3_12
- tox-python3_13
command: ./tools/ci/ci_tools_unittest.sh
env:
HYPOTHESIS_PROFILE: ci
Expand Down Expand Up @@ -487,13 +487,13 @@ tasks:
run-job:
- wpt_integration

- tools/ integration tests (Python 3.12):
- tools/ integration tests (Python 3.13):
description: >-
Integration tests for tools running under Python 3.12
Integration tests for tools running under Python 3.13
use:
- wpt-base
- trigger-pr
- tox-python3_12
- tox-python3_13
command: ./tools/ci/ci_tools_integration_test.sh
install:
- libnss3-tools
Expand Down Expand Up @@ -528,13 +528,13 @@ tasks:
run-job:
- resources_unittest

- resources/ tests (Python 3.12):
- resources/ tests (Python 3.13):
description: >-
Tests for testharness.js and other files in resources/ under Python 3.12
Tests for testharness.js and other files in resources/ under Python 3.13
use:
- wpt-base
- trigger-pr
- tox-python3_12
- tox-python3_13
command: ./tools/ci/ci_resources_unittest.sh
install:
- libnss3-tools
Expand Down
8 changes: 4 additions & 4 deletions tools/ci/tc/tests/test_valid.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ def test_verify_payload():
("pr_event.json", True, {".taskcluster.yml", ".travis.yml", "tools/ci/start.sh"},
['lint',
'tools/ unittests (Python 3.8)',
'tools/ unittests (Python 3.12)',
'tools/ unittests (Python 3.13)',
'tools/ integration tests (Python 3.8)',
'tools/ integration tests (Python 3.12)',
'tools/ integration tests (Python 3.13)',
'resources/ tests (Python 3.8)',
'resources/ tests (Python 3.12)',
'resources/ tests (Python 3.13)',
'download-firefox-nightly',
'infrastructure/ tests',
'sink-task']),
Expand All @@ -199,7 +199,7 @@ def test_verify_payload():
("pr_event_tests_affected.json", True, {"resources/testharness.js"},
['lint',
'resources/ tests (Python 3.8)',
'resources/ tests (Python 3.12)',
'resources/ tests (Python 3.13)',
'download-firefox-nightly',
'infrastructure/ tests',
'sink-task']),
Expand Down
1 change: 1 addition & 0 deletions tools/flake8.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ exclude =
third_party,
wptserve/docs/conf.py,
wptserve/tests/functional/docroot/invalid.py
wptserve/wptserve/cgi/
max-line-length = 141
2 changes: 1 addition & 1 deletion tools/manifest/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
zstandard==0.22.0
zstandard==0.23.0
5 changes: 4 additions & 1 deletion tools/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# - All setup.py files (avoiding duplicate module named "setup")
# - tools/wptserve/docs/conf.py (generated code)
# - tools/wptserve/tests/ (deliberately invalid syntax)
exclude = (^tools/third_party/|/setup\.py$|^tools/wptserve/docs/conf.py|^tools/wptserve/tests/|^tools/third_party_modified/mozlog/)
exclude = (^tools/third_party/|/setup\.py$|^tools/wptserve/docs/conf.py|^tools/wptserve/tests/|^tools/third_party_modified/mozlog/|^tools/wptserve/wptserve/cgi/test_cgi\.py$)
mypy_path = tools/wptrunner:tools/wptserve:tools/webdriver:tools/webtransport
#check_untyped_defs = True
disallow_any_generics = True
Expand Down Expand Up @@ -36,6 +36,9 @@ ignore_missing_imports = True
[mypy-Quartz.*]
ignore_missing_imports = True

[mypy-cgi.*]
ignore_missing_imports = True

[mypy-github.*]
ignore_missing_imports = True

Expand Down
1 change: 0 additions & 1 deletion tools/requirements_mypy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mypy==1.14.0
mypy-extensions==1.0.0
toml==0.10.2
tomli==2.0.1
typed-ast==1.5.5
types-atomicwrites==1.4.5.1
types-python-dateutil==2.9.0.20240906
types-PyYAML==6.0.12.12
Expand Down
5 changes: 1 addition & 4 deletions tools/serve/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -1418,10 +1418,7 @@ def run(config_cls=ConfigBuilder, route_builder=None, mp_context=None, log_handl
logger = get_logger("INFO", log_handlers)

if mp_context is None:
if hasattr(multiprocessing, "get_context"):
mp_context = multiprocessing.get_context()
else:
mp_context = MpContext()
mp_context = multiprocessing.get_context("spawn")

with build_config(logger,
os.path.join(repo_root, "config.json"),
Expand Down
2 changes: 1 addition & 1 deletion tools/tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38,py39,py310,py311,py312,{py38,py39,py310,py311,py312}-{flake8,mypy}
envlist = py38,py39,py310,py311,py312,py313,{py38,py39,py310,py311,py312,py313}-{flake8,mypy}
skipsdist=True
skip_missing_interpreters=False

Expand Down
2 changes: 1 addition & 1 deletion tools/wave/tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38,py39,py310,py311,py312
envlist = py38,py39,py310,py311,py312,py312
skipsdist=True
skip_missing_interpreters = False

Expand Down
2 changes: 1 addition & 1 deletion tools/wpt/tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38,py39,py310,py311,py312
envlist = py38,py39,py310,py311,py312,py312
skipsdist=True
skip_missing_interpreters = False

Expand Down
3 changes: 2 additions & 1 deletion tools/wptrunner/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ mozinfo==1.2.3 # https://bugzilla.mozilla.org/show_bug.cgi?id=1621226
mozlog==8.0.0
mozprocess==1.3.1
packaging==24.0
pillow==10.3.0
pillow==10.4.0; python_version < '3.9'
pillow==11.1.0; python_version >= '3.9'
requests==2.32.3
six==1.16.0
urllib3==2.2.2
2 changes: 1 addition & 1 deletion tools/wptrunner/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xfail_strict=true

[tox]
envlist = py312-{base,chrome,firefox,opera,safari,sauce,servo,webkit,webkitgtk_minibrowser,epiphany},{py38,py39,py310,py311}-base
envlist = py313-{base,chrome,firefox,opera,safari,sauce,servo,webkit,webkitgtk_minibrowser,epiphany},{py38,py39,py310,py311,py312}-base
skip_missing_interpreters = False

[testenv]
Expand Down
23 changes: 22 additions & 1 deletion tools/wptrunner/wptrunner/wptlogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import logging
from threading import Thread
from types import TracebackType
from typing import Optional, Type

from mozlog import commandline, stdadapter, set_default_logger
from mozlog.structuredlog import StructuredLogger, log_levels
Expand Down Expand Up @@ -77,7 +79,7 @@ def __init__(self, queue, level=logging.NOTSET):

def createLock(self):
# The queue provides its own locking
self.lock = None
self.lock = NullRLock()

def emit(self, record):
msg = self.format(record)
Expand All @@ -90,6 +92,25 @@ def emit(self, record):
self.queue.put(data)



class NullRLock:
"""Implementation of the threading.RLock API that doesn't actually acquire a lock,
for use in cases where there is another mechanism to provide the required
invariants."""

def acquire(self, blocking: bool = True, timeout: float = -1) -> bool:
return True

def release(self) -> None:
return None

def __enter__(self) -> bool:
return True

def __exit__(self, t: Optional[Type[BaseException]], v: Optional[BaseException], tb: Optional[TracebackType]) -> None:
return None


class LogQueueThread(Thread):
"""Thread for handling log messages from a queue"""
def __init__(self, queue, logger):
Expand Down
Loading
Loading