Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
tests: modernize and speed up on Python 3.14
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed May 8, 2025
commit 922b099aa422f1060e3be86272e306e2a6538c3b
12 changes: 6 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,31 @@
]
)
def tests(session):
def coverage(*args):
session.run("python", "-m", "coverage", *args)
coverage = ["python", "-m", "coverage"]

session.install("-r", "tests/requirements.txt")
session.install(".")
env = {} if session.python != "3.14" else {"COVERAGE_CORE": "sysmon"}

if "pypy" not in session.python:
coverage(
session.run(
*coverage,
"run",
"--source",
"packaging",
"-m",
"pytest",
"--strict-markers",
*session.posargs,
env=env,
)
coverage("report", "-m", "--fail-under", "100")
session.run(*coverage, "report", "-m", "--fail-under", "100")
else:
# Don't do coverage tracking for PyPy, since it's SLOW.
session.run(
"python",
"-m",
"pytest",
"--capture=no",
"--strict-markers",
*session.posargs,
)

Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ branch = true
[tool.coverage.report]
exclude_lines = ["pragma: no cover", "@abc.abstractmethod", "@abc.abstractproperty"]

[tool.pytest.ini_options]
minversion = "6.2"
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
xfail_strict = true
filterwarnings = ["error"]
log_cli_level = "INFO"
testpaths = ["tests"]


[tool.mypy]
strict = true
Expand Down
5 changes: 1 addition & 4 deletions tests/test_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import platform
import sys
import types
import warnings

import pretend
import pytest
Expand Down Expand Up @@ -72,10 +71,8 @@ def test_is_manylinux_compatible_glibc_support(version, compatible, monkeypatch)

@pytest.mark.parametrize("version_str", ["glibc-2.4.5", "2"])
def test_check_glibc_version_warning(version_str):
with warnings.catch_warnings(record=True) as w:
with pytest.warns(RuntimeWarning):
_parse_glibc_version(version_str)
assert len(w) == 1
assert issubclass(w[0].category, RuntimeWarning)


@pytest.mark.skipif(not ctypes, reason="requires ctypes")
Expand Down