Skip to content

Commit e900655

Browse files
authored
GHA: Enable Python 3.14 (#131)
* GitHub Action: Enable Python 3.14 * Upgrade lxml, remove install step of header files * Bump lxml to >=6.0.0 * Upgrade with "uv lock --upgrade-package lxml" * Fix TimeoutError test for Python 3.14 * Raise wait time * Use a 'fork' context so the child does not need to import the test package (spawn/forkserver can fail to import test modules under some Python versions) * Use the 'fork' start method on platforms * Introduce PYPROJECT_GROUP=tests in `.github/workflows/ci.yml`
1 parent 7918eed commit e900655

5 files changed

Lines changed: 29 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ env:
2929
UV_FROZEN: "1"
3030
# Needed for coverage/multiprocessing reliability
3131
PYTHONSTARTMETHOD: spawn
32+
# The group to use for installing/testing dependencies
33+
PYPROJECT_GROUP: tests
3234

3335
jobs:
3436
test-ubuntu:
@@ -40,7 +42,7 @@ jobs:
4042
python-version: &python-matrix
4143
- '3.12'
4244
- '3.13'
43-
# - '3.14'
45+
- '3.14'
4446
container:
4547
image: registry.opensuse.org/documentation/containers/15.6/opensuse-daps-toolchain:latest
4648
steps:
@@ -81,7 +83,7 @@ jobs:
8183
cache-dependency-glob: "uv.lock"
8284

8385
- name: Install dependencies and Coverage Tools
84-
run: uv sync --group tests
86+
run: uv sync --group ${{ env.PYPROJECT_GROUP }}
8587

8688
- name: Run tests and Report Coverage
8789
env:
@@ -189,7 +191,7 @@ jobs:
189191
python3 -m venv .venv
190192
source .venv/bin/activate
191193
pip install uv
192-
uv pip install --editable . --group devel
194+
uv pip install --editable . --group ${{ env.PYPROJECT_GROUP }}
193195
194196
# Install macOS-specific external tools (such as XML parsers and Java)
195197
- name: Install external tools (macOS)

changelog.d/131.infra.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Enable Python 3.14 for GitHub Action

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ license-files = ["LICENSE"]
2222
dependencies = [
2323
"click>=8.1.8",
2424
"jinja2>=3.1.6,<4.0.0",
25-
"lxml>=5.4.0",
25+
"lxml>=6.0.0",
2626
"pydantic>=2.11.4",
2727
"rich>=14.0.0",
2828
"tomlkit>=0.13.2",
@@ -89,7 +89,6 @@ devel = [
8989
# {include-group = "publish"},
9090
]
9191

92-
9392
[project.scripts]
9493
docbuild = "docbuild.__main__:cli"
9594

tests/utils/test_pidlock.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,27 @@ def test_lock_prevents_concurrent_access_in_separate_process(lock_setup):
8888
lock_dir.mkdir()
8989
lock_path = PidFileLock(resource_path, lock_dir).lock_path
9090

91+
# Use the 'fork' start method on platforms where it is available.
92+
# This avoids issues with importing the 'tests' package in spawned
93+
# child processes (e.g. when using forkserver/spawn).
94+
try:
95+
ctx = mp.get_context("fork")
96+
except ValueError: # pragma: no cover - defensive for non-fork platforms
97+
pytest.skip("multiprocessing 'fork' context not available on this platform")
98+
9199
# Create an Event to signal the child process to release the lock
92-
done_event = mp.Event()
100+
done_event = ctx.Event()
93101

94102
# Start a background process to hold the lock
95-
lock_holder = mp.Process(
103+
lock_holder = ctx.Process(
96104
target=_mp_lock_holder, args=(resource_path, lock_dir, lock_path, done_event)
97105
)
98106
lock_holder.start()
99107

100108
# Wait for the lock holder to acquire the lock (check for lock file existence)
101109
timeout_start = time.time()
102110
while not lock_path.exists():
103-
if time.time() - timeout_start > 5:
111+
if (time.time() - timeout_start) > 10:
104112
raise TimeoutError("Child process failed to acquire lock in time.")
105113
time.sleep(0.01)
106114

uv.lock

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)