File: test_leaks.py

package info (click to toggle)
python-multidict 6.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 896 kB
  • sloc: ansic: 6,634; python: 4,399; makefile: 227
file content (31 lines) | stat: -rw-r--r-- 784 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pathlib
import platform
import subprocess
import sys

import pytest

IS_PYPY = platform.python_implementation() == "PyPy"


@pytest.mark.parametrize(
    ("script"),
    (
        "multidict_extend_dict.py",
        "multidict_extend_multidict.py",
        "multidict_extend_tuple.py",
        "multidict_update_multidict.py",
    ),
)
@pytest.mark.leaks
@pytest.mark.skipif(IS_PYPY, reason="leak testing is not supported on PyPy")
def test_leak(script: str) -> None:
    """Run isolated leak test script and check for leaks."""
    leak_test_script = pathlib.Path(__file__).parent.joinpath("isolated", script)

    subprocess.run(
        [sys.executable, "-u", str(leak_test_script)],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        check=True,
    )