diff options
author | David Lord <davidism@gmail.com> | 2024-05-11 13:17:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-11 13:17:04 -0700 |
commit | 53d7cb7c5c8fedc84165610466b3c3346eee2be7 (patch) | |
tree | 12c273ca8906ff76f30af5f0e58b33b0f7e7fe4d | |
parent | 52d35f57ee0ba9dd8d74032f7741c27f27b05edf (diff) | |
parent | ceccb11b79979f6f52a057ea99fadbeddad52faa (diff) | |
download | markupsafe-upstream-main.tar.gz |
test with python 3.13 (#446)upstream-main
-rw-r--r-- | .github/workflows/tests.yaml | 1 | ||||
-rw-r--r-- | tests/test_leak.py | 22 | ||||
-rw-r--r-- | tox.ini | 2 |
3 files changed, 10 insertions, 15 deletions
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c852936..a7ad601 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -21,6 +21,7 @@ jobs: fail-fast: false matrix: include: + - {python: '3.13'} - {python: '3.12'} - {name: Windows, python: '3.12', os: windows-latest} - {name: Mac, python: '3.12', os: macos-latest} diff --git a/tests/test_leak.py b/tests/test_leak.py index 260f484..b786e07 100644 --- a/tests/test_leak.py +++ b/tests/test_leak.py @@ -1,31 +1,25 @@ from __future__ import annotations import gc -import platform -import pytest - -from markupsafe import _escape_inner # type: ignore[attr-defined] from markupsafe import escape -@pytest.mark.skipif( - _escape_inner.__module__ == "markupsafe._native", - reason="only test memory leak with speedups", -) def test_markup_leaks() -> None: counts = set() + # Try to start with a "clean" count. Works for PyPy but not 3.13 JIT. + gc.collect() - for _i in range(20): - for _j in range(1000): + for _ in range(20): + for _ in range(1000): escape("foo") escape("<foo>") escape("foo") escape("<foo>") - if platform.python_implementation() == "PyPy": - gc.collect() - counts.add(len(gc.get_objects())) - assert len(counts) == 1 + # Some implementations, such as PyPy and Python 3.13 JIT, end up with 2 + # counts rather than one. Presumably this is internals stabilizing. A leak + # would presumably have a different count every loop. + assert len(counts) < 3 @@ -1,6 +1,6 @@ [tox] envlist = - py3{12,11,10,9,8} + py3{13,12,11,10,9,8} pypy310 style typing |