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
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v7.1.0
with:
python-version: "3.8"
python-version: "3.11"
- name: Install GoogleTest
run: |
wget https://github.com/google/googletest/archive/release-${{ matrix.gtest_ver }}.tar.gz
tar -zxvf release-${{ matrix.gtest_ver }}.tar.gz
cd googletest-release-${{ matrix.gtest_ver }}
mkdir build
cd build
cmake ..
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ..
sudo make install
- name: Install Boost.Test
run: |
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python: ["3.11", "3.12", "3.13", "3.14", "3.15"]

steps:
- uses: actions/checkout@v7.0.1
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# UNRELEASED

- Dropped support for EOL Python 3.8, 3.9, and 3.10.
- Added support for Python 3.13, 3.14, and 3.15.

# 2.6.0

*2024-09-17*
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"pytest11": ["cpp = pytest_cpp.plugin"],
},
install_requires=["pytest"],
python_requires=">=3.8",
python_requires=">=3.11",
author="Bruno Oliveira",
author_email="nicoddemus@gmail.com",
description="Use pytest's runner to discover and execute C++ tests",
Expand All @@ -26,11 +26,11 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Programming Language :: C++",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
Expand Down
11 changes: 5 additions & 6 deletions src/pytest_cpp/boost.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from __future__ import annotations

import io
import os
import subprocess
import tempfile
from typing import Sequence
from collections.abc import Sequence
from xml.etree import ElementTree

from pytest_cpp.error import CppTestFailure
Expand All @@ -29,7 +28,7 @@ def is_test_suite(
output = subprocess.check_output(
args,
stderr=subprocess.STDOUT,
universal_newlines=True,
text=True,
)
except (subprocess.CalledProcessError, OSError):
return False
Expand All @@ -55,9 +54,9 @@ def run_test(
) -> tuple[Sequence[BoostTestFailure] | None, str]:
def read_file(name: str) -> str:
try:
with io.open(name) as f:
with open(name) as f:
return f.read()
except IOError:
except OSError:
return ""

with tempfile.TemporaryDirectory(prefix="pytest-cpp") as temp_dir:
Expand Down Expand Up @@ -128,7 +127,7 @@ def _parse_log(self, log: str) -> list[BoostTestFailure]:
# Boosttest will sometimes generate unparseable XML
# so we surround it with xml tags.
parsed_elements = []
log = "<xml>{}</xml>".format(log)
log = f"<xml>{log}</xml>"

log_root = ElementTree.fromstring(log)
testlog = log_root.find("TestLog")
Expand Down
11 changes: 5 additions & 6 deletions src/pytest_cpp/catch2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import os
import subprocess
import tempfile
from typing import Optional
from typing import Sequence
from collections.abc import Sequence
from xml.etree import ElementTree

import pytest
Expand Down Expand Up @@ -39,13 +38,13 @@ def get_catch_version(
cls,
executable: str,
harness_collect: Sequence[str] = (),
) -> Optional[Catch2Version]:
) -> Catch2Version | None:
args = make_cmdline(harness_collect, executable, ["--help"])
try:
output = subprocess.check_output(
args,
stderr=subprocess.STDOUT,
universal_newlines=True,
text=True,
)
except (subprocess.CalledProcessError, OSError):
return None
Expand Down Expand Up @@ -91,7 +90,7 @@ def list_tests(
output = subprocess.check_output(
args,
stderr=subprocess.STDOUT,
universal_newlines=True,
text=True,
)
except subprocess.CalledProcessError as e:
output = e.output
Expand Down Expand Up @@ -132,7 +131,7 @@ def run_test(

try:
output = subprocess.check_output(
args, stderr=subprocess.STDOUT, universal_newlines=True
args, stderr=subprocess.STDOUT, text=True
)
except subprocess.CalledProcessError as e:
output = e.output
Expand Down
9 changes: 4 additions & 5 deletions src/pytest_cpp/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import string
from abc import ABC
from abc import abstractmethod
from typing import Sequence
from typing import Tuple
from collections.abc import Sequence

from _pytest._code.code import ReprFileLocation
from _pytest._io import TerminalWriter
Expand All @@ -20,7 +19,7 @@ def __init__(self, failures: Sequence[CppTestFailure]) -> None:
self.failures = list(failures)


Markup = Tuple[str, ...]
Markup = tuple[str, ...]


class CppTestFailure(ABC):
Expand Down Expand Up @@ -49,7 +48,7 @@ def get_file_reference(self) -> tuple[str, int]:
"""


class CppFailureRepr(object):
class CppFailureRepr:
"""
"repr" object for pytest that knows how to print a CppFailure instance
into both terminal and files.
Expand All @@ -65,7 +64,7 @@ def __str__(self) -> str:
for failure in self.failures:
pure_lines = "\n".join(x[0] for x in failure.get_lines())
repr_loc = self._get_repr_file_location(failure)
reprs.append("%s\n%s" % (pure_lines, repr_loc))
reprs.append(f"{pure_lines}\n{repr_loc}")
return self.failure_sep.join(reprs)

def _get_repr_file_location(self, failure: CppTestFailure) -> ReprFileLocation:
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_cpp/facade_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from abc import ABC
from abc import abstractmethod
from typing import Sequence
from collections.abc import Sequence

from pytest_cpp.error import CppTestFailure

Expand Down
8 changes: 4 additions & 4 deletions src/pytest_cpp/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import subprocess
import tempfile
from typing import Sequence
from collections.abc import Sequence
from xml.etree import ElementTree

import pytest
Expand All @@ -30,7 +30,7 @@ def is_test_suite(
output = subprocess.check_output(
args,
stderr=subprocess.STDOUT,
universal_newlines=True,
text=True,
)
except (subprocess.CalledProcessError, OSError):
return False
Expand All @@ -55,7 +55,7 @@ def list_tests(
output = subprocess.check_output(
args,
stderr=subprocess.STDOUT,
universal_newlines=True,
text=True,
)

def strip_comment(x: str) -> str:
Expand Down Expand Up @@ -100,7 +100,7 @@ def run_test(

try:
output = subprocess.check_output(
args, stderr=subprocess.STDOUT, universal_newlines=True
args, stderr=subprocess.STDOUT, text=True
)
except subprocess.CalledProcessError as e:
output = e.output
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_cpp/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Sequence
from collections.abc import Sequence


def make_cmdline(
Expand Down
9 changes: 4 additions & 5 deletions src/pytest_cpp/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import os
import stat
import sys
from collections.abc import Iterator
from collections.abc import Sequence
from fnmatch import fnmatch
from pathlib import Path
from typing import Any
from typing import Iterator
from typing import Sequence
from typing import Type
from typing import TYPE_CHECKING

import pytest
Expand All @@ -24,7 +23,7 @@
from _pytest._code.code import TerminalRepr


FACADES: Sequence[Type[AbstractFacade]] = (
FACADES: Sequence[type[AbstractFacade]] = (
GoogleTestFacade,
BoostTestFacade,
Catch2Facade,
Expand Down Expand Up @@ -123,7 +122,7 @@ def __init__(
self,
*,
path: Path,
parent: pytest.Item,
parent: pytest.Collector,
facade: AbstractFacade,
arguments: Sequence[str],
**kwargs: Any,
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{38, 39, 310, 311, 312}
envlist = py{311, 312, 313, 314, 315}

[testenv]
deps=
Expand Down
Loading