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 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 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: 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.13'
pillow==11.1.0; python_version >= '3.13'
jgraham marked this conversation as resolved.
Show resolved Hide resolved
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
17 changes: 16 additions & 1 deletion tools/wptrunner/wptrunner/wptlogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(self, queue, level=logging.NOTSET):

def createLock(self):
# The queue provides its own locking
self.lock = None
self.lock = NullLock()
gsnedders marked this conversation as resolved.
Show resolved Hide resolved

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



class NullLock:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this is brand new code, can we please actually add types for all of this? This should, I think, match: https://github.com/python/typeshed/blob/614e9499f145e9dccade16d906247276f1d5e6aa/stdlib/_thread.pyi#L16-L20

Can we also add a comment saying that this implements the interface of threading.RLock, and probably rename this to NullRLock, to clarify this doesn't match threading.Lock?

def acquire(self):
pass

def release(self):
pass

def __enter__(self):
return self

def __exit__(self, *args, **kwargs):
pass


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