Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
python-version: ${{ matrix.python }}
allow-prereleases: true
- run: uv run --locked tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
- if: endsWith(matrix.python, 't')
run: uv run --locked tox run -e parallel
typing:
runs-on: ubuntu-latest
steps:
Expand Down
19 changes: 16 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pre-commit = [
]
tests = [
"pytest",
"pytest-run-parallel; python_full_version >= '3.13'",
]
typing = [
"mypy",
Expand All @@ -67,7 +68,10 @@ testpaths = ["tests"]
filterwarnings = [
"error",
]

markers = [
# Needed when pytest-run-parallel is not installed
"thread_unsafe: mark test as not safe to run in multiple threads",
]
[tool.coverage.run]
branch = true
source = ["markupsafe", "tests"]
Expand Down Expand Up @@ -124,8 +128,8 @@ tag-only = [

[tool.tox]
env_list = [
"py3.14", "py3.14t", "py3.13", "py3.13t",
"py3.12", "py3.11", "py3.10", "py3.9",
"py3.14", "py3.14t", "parallel",
"py3.13", "py3.13t", "py3.12", "py3.11", "py3.10", "py3.9",
"pypy3.11",
"style",
"typing",
Expand All @@ -145,6 +149,15 @@ commands = [[
{replace = "posargs", default = [], extend = true},
]]

[tool.tox.env.parallel]
description = "check for free threading issues"
base_python = ["3.14t"]
commands = [[
"pytest", "-v", "--tb=short", "--basetemp=env_tmp_dir",
"--parallel-threads=8",
{replace = "posargs", default = [], extend = true},
]]

[tool.tox.env.style]
description = "run all pre-commit hooks on all files"
dependency_groups = ["pre-commit"]
Expand Down
1 change: 1 addition & 0 deletions tests/test_ext_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
_speedups = None # type: ignore[assignment]


@pytest.mark.thread_unsafe(reason="Tampers with sys.modules")
@pytest.mark.skipif(_speedups is None, reason="speedups unavailable")
def test_ext_init() -> None:
"""Test that the extension module uses multi-phase init by checking that
Expand Down
3 changes: 3 additions & 0 deletions tests/test_leak.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import gc

import pytest

from markupsafe import escape


@pytest.mark.thread_unsafe(reason="Tests gc.get_objects()")
def test_markup_leaks() -> None:
counts = set()
# Try to start with a "clean" count. Works for PyPy but not 3.13 JIT.
Expand Down
35 changes: 28 additions & 7 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading