Skip to content

Commit 922b099

Browse files
committed
tests: modernize and speed up on Python 3.14
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 7591cc5 commit 922b099

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

noxfile.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,31 @@
3737
]
3838
)
3939
def tests(session):
40-
def coverage(*args):
41-
session.run("python", "-m", "coverage", *args)
40+
coverage = ["python", "-m", "coverage"]
4241

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

4646
if "pypy" not in session.python:
47-
coverage(
47+
session.run(
48+
*coverage,
4849
"run",
4950
"--source",
5051
"packaging",
5152
"-m",
5253
"pytest",
53-
"--strict-markers",
5454
*session.posargs,
55+
env=env,
5556
)
56-
coverage("report", "-m", "--fail-under", "100")
57+
session.run(*coverage, "report", "-m", "--fail-under", "100")
5758
else:
5859
# Don't do coverage tracking for PyPy, since it's SLOW.
5960
session.run(
6061
"python",
6162
"-m",
6263
"pytest",
6364
"--capture=no",
64-
"--strict-markers",
6565
*session.posargs,
6666
)
6767

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ branch = true
4747
[tool.coverage.report]
4848
exclude_lines = ["pragma: no cover", "@abc.abstractmethod", "@abc.abstractproperty"]
4949

50+
[tool.pytest.ini_options]
51+
minversion = "6.2"
52+
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
53+
xfail_strict = true
54+
filterwarnings = ["error"]
55+
log_cli_level = "INFO"
56+
testpaths = ["tests"]
57+
5058

5159
[tool.mypy]
5260
strict = true

tests/test_manylinux.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import platform
88
import sys
99
import types
10-
import warnings
1110

1211
import pretend
1312
import pytest
@@ -72,10 +71,8 @@ def test_is_manylinux_compatible_glibc_support(version, compatible, monkeypatch)
7271

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

8077

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

0 commit comments

Comments
 (0)