Skip to content
Merged
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: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
args: ['--application-directories=.:src']
name: reorder python imports
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
rev: 26.1.0
hooks:
- id: black
args: [--safe, --quiet]
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from setuptools import setup


setup(
name="pytest-cpp",
use_scm_version=True,
Expand Down
1 change: 0 additions & 1 deletion src/pytest_cpp/catch2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from pytest_cpp.facade_abc import AbstractFacade
from pytest_cpp.helpers import make_cmdline


# Map each special character's Unicode ordinal to the escaped character.
_special_chars_map: dict[int, str] = {i: "\\" + chr(i) for i in b'[]*,~\\"'}

Expand Down
6 changes: 3 additions & 3 deletions src/pytest_cpp/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(
self._arguments = arguments

@classmethod
def from_parent( # type:ignore[override]
def from_parent( # type: ignore[override]
cls,
*,
parent: pytest.Collector,
Expand Down Expand Up @@ -175,7 +175,7 @@ def __init__(
self._arguments = arguments

@classmethod
def from_parent( # type:ignore[override]
def from_parent( # type: ignore[override]
cls,
*,
parent: pytest.Collector,
Expand Down Expand Up @@ -204,7 +204,7 @@ def runtest(self) -> None:
if failures:
raise CppFailureError(failures)

def repr_failure( # type:ignore[override]
def repr_failure( # type: ignore[override]
self, excinfo: pytest.ExceptionInfo[BaseException]
) -> str | TerminalRepr | CppFailureRepr:
if isinstance(excinfo.value, CppFailureError):
Expand Down
54 changes: 18 additions & 36 deletions tests/test_pytest_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,10 @@ def test_cpp_files_option(testdir, exes):
result = testdir.runpytest("--collect-only")
result.stdout.fnmatch_lines("* no tests *")

testdir.makeini(
"""
testdir.makeini("""
[pytest]
cpp_files = gtest* boost*
"""
)
""")
result = testdir.runpytest("--collect-only")
result.stdout.fnmatch_lines(
[
Expand All @@ -364,12 +362,10 @@ def test_cpp_files_option(testdir, exes):
def test_cpp_ignore_py_files(testdir, exes):
file_name = "cpptest_success.py"
exes.get("gtest", "cpptest_success.py")
testdir.makeini(
"""
testdir.makeini("""
[pytest]
cpp_files = cpptest_*
"""
)
""")

result = testdir.runpytest("--collect-only")
result.stdout.fnmatch_lines("* no tests *")
Expand All @@ -388,24 +384,20 @@ def test_cpp_ignore_py_files(testdir, exes):


def test_google_one_argument(testdir, exes):
testdir.makeini(
"""
testdir.makeini("""
[pytest]
cpp_arguments = argument1
"""
)
""")

result = testdir.inline_run(exes.get("gtest_args"), "-k", "ArgsTest.one_argument")
assert_outcomes(result, [("ArgsTest.one_argument", "passed")])


def test_google_two_arguments(testdir, exes):
testdir.makeini(
"""
testdir.makeini("""
[pytest]
cpp_arguments = argument1 argument2
"""
)
""")

result = testdir.inline_run(exes.get("gtest_args"), "-k", "ArgsTest.two_arguments")
assert_outcomes(result, [("ArgsTest.two_arguments", "passed")])
Expand Down Expand Up @@ -434,12 +426,10 @@ def test_google_two_arguments_via_option(testdir, exes):


def test_argument_option_priority(testdir, exes):
testdir.makeini(
"""
testdir.makeini("""
[pytest]
cpp_arguments = argument2
"""
)
""")
result = testdir.inline_run(
exes.get("gtest_args"),
"-k",
Expand All @@ -466,24 +456,20 @@ def test_google_cpp_harness_via_option(testdir, exes):


def test_boost_one_argument(testdir, exes):
testdir.makeini(
"""
testdir.makeini("""
[pytest]
cpp_arguments = argument1
"""
)
""")

result = testdir.inline_run(exes.get("boost_one_argument"))
assert_outcomes(result, [("boost_one_argument", "passed")])


def test_boost_two_arguments(testdir, exes):
testdir.makeini(
"""
testdir.makeini("""
[pytest]
cpp_arguments = argument1 argument2
"""
)
""")

result = testdir.inline_run(exes.get("boost_two_arguments"))
assert_outcomes(result, [("boost_two_arguments", "passed")])
Expand Down Expand Up @@ -569,12 +555,10 @@ def test_output_section(testdir, exes):
exes.get("boost_failure")
exes.get("gtest")

testdir.makeini(
"""
testdir.makeini("""
[pytest]
cpp_files = gtest* boost*
"""
)
""")
result = testdir.runpytest("-k", "failure")
result.stdout.fnmatch_lines(
[
Expand All @@ -589,12 +573,10 @@ def test_cpp_verbose(testdir, exes):
exes.get("boost_success")
exes.get("gtest")

testdir.makeini(
"""
testdir.makeini("""
[pytest]
cpp_files = gtest* boost*
"""
)
""")
result = testdir.runpytest("-k", "success", "-s", "-o", "cpp_verbose=true")
result.stdout.fnmatch_lines(
["*Just saying hi from boost", "*Just saying hi from gtest"]
Expand Down