Skip to content

Commit 6d41fc4

Browse files
committed
Drop Python 3.6 and require pytest >=7
Fixes #82
1 parent 23d2362 commit 6d41fc4

File tree

6 files changed

+29
-51
lines changed

6 files changed

+29
-51
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,16 @@ jobs:
6060
strategy:
6161
fail-fast: false
6262
matrix:
63-
python: ["3.6", "3.7", "3.8", "3.9", "3.10"]
63+
python: ["3.7", "3.8", "3.9", "3.10"]
6464
include:
65-
- python: "3.6"
66-
tox_env: "py36-pytestlatest"
6765
- python: "3.7"
68-
tox_env: "py37-pytestlatest"
66+
tox_env: "py37"
6967
- python: "3.8"
70-
tox_env: "py38-pytestlatest"
68+
tox_env: "py38"
7169
- python: "3.9"
72-
tox_env: "py39-pytestlatest py39-pytest53"
70+
tox_env: "py39"
7371
- python: "3.10"
74-
tox_env: "py310-pytestlatest"
72+
tox_env: "py310"
7573

7674
steps:
7775
- uses: actions/checkout@v1

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.3.0 (2022-08-22)
2+
3+
- Dropped support for Python 3.6.
4+
- This plugin now requires pytest >=7.0.
5+
16
# 2.1.2 (2022-03-18)
27

38
- Fix warnings in pytest 7.0 ([#78](https://github.com/pytest-dev/pytest-cpp/issues/78)).

setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
"pytest11": ["cpp = pytest_cpp.plugin"],
1212
},
1313
install_requires=[
14-
"pytest !=5.4.0, !=5.4.1",
14+
"pytest >=7.0",
1515
"colorama",
1616
],
17-
python_requires=">=3.6",
18-
# metadata for upload to PyPI
17+
python_requires=">=3.7",
1918
author="Bruno Oliveira",
2019
author_email="[email protected]",
2120
description="Use pytest's runner to discover and execute C++ tests",
@@ -30,10 +29,10 @@
3029
"License :: OSI Approved :: MIT License",
3130
"Operating System :: OS Independent",
3231
"Programming Language :: Python :: 3",
33-
"Programming Language :: Python :: 3.6",
3432
"Programming Language :: Python :: 3.7",
3533
"Programming Language :: Python :: 3.8",
3634
"Programming Language :: Python :: 3.9",
35+
"Programming Language :: Python :: 3.10",
3736
"Programming Language :: C++",
3837
"Topic :: Software Development :: Quality Assurance",
3938
"Topic :: Software Development :: Testing",

src/pytest_cpp/error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import string
22

33
import os
4-
from py._code.code import ReprFileLocation
4+
from _pytest._code.code import ReprFileLocation
55

66

77
class CppFailureError(Exception):

src/pytest_cpp/plugin.py

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
_ARGUMENTS = "cpp_arguments"
1717

1818

19-
# pytest 5.4 introduced the 'from_parent' constructor
20-
needs_from_parent = hasattr(pytest.Item, "from_parent")
21-
22-
2319
def matches_any_mask(path, masks):
2420
"""Return True if the given path matches any of the masks given"""
2521
if sys.platform.startswith("win"):
@@ -52,20 +48,12 @@ def pytest_collect_file(parent, file_path):
5248

5349
for facade_class in FACADES:
5450
if facade_class.is_test_suite(str(file_path)):
55-
if needs_from_parent:
56-
return CppFile.from_parent(
57-
path=file_path,
58-
parent=parent,
59-
facade=facade_class(),
60-
arguments=test_args,
61-
)
62-
else:
63-
return CppFile(
64-
path=file_path,
65-
parent=parent,
66-
facade_class=facade_class(),
67-
arguments=test_args,
68-
)
51+
return CppFile.from_parent(
52+
path=file_path,
53+
parent=parent,
54+
facade=facade_class(),
55+
arguments=test_args,
56+
)
6957

7058

7159
def pytest_addoption(parser):
@@ -115,15 +103,12 @@ def from_parent(cls, *, parent, path, facade, arguments, **kwargs):
115103

116104
def collect(self):
117105
for test_id in self.facade.list_tests(str(self.fspath)):
118-
if needs_from_parent:
119-
yield CppItem.from_parent(
120-
parent=self,
121-
name=test_id,
122-
facade=self.facade,
123-
arguments=self._arguments,
124-
)
125-
else:
126-
yield CppItem(test_id, self, self.facade, self._arguments)
106+
yield CppItem.from_parent(
107+
parent=self,
108+
name=test_id,
109+
facade=self.facade,
110+
arguments=self._arguments,
111+
)
127112

128113

129114
class CppItem(pytest.Item):

tox.ini

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
[tox]
2-
envlist = py{36,37,38,39}-pytestlatest,py39-pytest53
2+
envlist = py{37,38,39,310}
33

44
[testenv]
55
deps=
6-
pytestlatest: pytest
7-
pytestlatest: pytest-xdist
8-
pytest53: pytest~=5.3
9-
pytest53: pytest-xdist<2
6+
pytest
7+
pytest-xdist
108
pytest-mock
119
coverage
1210
commands=
1311
pytest tests
1412
pytest -n2 tests
15-
16-
[testenv:linting]
17-
skipsdist = True
18-
usedevelop = True
19-
deps = pre-commit
20-
basepython = python3.7
21-
commands = pre-commit run --all-files --show-diff-on-failure

0 commit comments

Comments
 (0)