Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add some useful pytest config #837

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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: 0 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def coverage(*args):
"packaging",
"-m",
"pytest",
"--strict-markers",
*session.posargs,
)
coverage("report", "-m", "--fail-under", "100")
Expand All @@ -59,7 +58,6 @@ def coverage(*args):
"-m",
"pytest",
"--capture=no",
"--strict-markers",
*session.posargs,
)

Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ include = ["LICENSE*", "tests/", "docs/", "CHANGELOG.rst"]
exclude = ["docs/_build", "tests/manylinux/build-hello-world.sh", "tests/musllinux/build.sh", "tests/hello-world.c", "tests/__pycache__", "build/__pycache__"]


[tool.pytest.ini_options]
addopts = ["--strict-markers", "--strict-config"]
xfail_strict = true
filterwarnings = [
"error",
]
testpaths = ["tests"]


[tool.coverage.run]
branch = true

Expand Down
7 changes: 3 additions & 4 deletions tests/test_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import os
import pathlib
import platform
import re
import sys
import types
import warnings

import pretend
import pytest
Expand Down Expand Up @@ -72,10 +72,9 @@ 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:
msg = f"Expected glibc version with 2 components major.minor, got: {version_str}"
with pytest.warns(RuntimeWarning, match=re.escape(msg)):
_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
Loading