Skip to content

Commit df38531

Browse files
authored
Merge pull request #83 from nicoddemus/drop-py36-pytest-6
2 parents 23d2362 + 3c84f99 commit df38531

File tree

11 files changed

+53
-61
lines changed

11 files changed

+53
-61
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,23 @@ 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", "3.11-dev"]
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"
73+
- python: "3.11-dev"
74+
tox_env: "py311"
7575

7676
steps:
77-
- uses: actions/checkout@v1
77+
- uses: actions/checkout@v2
7878
- name: Set up Python
79-
uses: actions/setup-python@v1
79+
uses: actions/setup-python@v2
8080
with:
8181
python-version: ${{ matrix.python }}
8282
- name: Download compiled tests

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
exclude: '^($|.*\.bin)'
22
repos:
3+
- repo: https://github.com/asottile/reorder_python_imports
4+
rev: v3.8.2
5+
hooks:
6+
- id: reorder-python-imports
7+
args: ['--application-directories=.:src']
8+
name: reorder python imports
39
- repo: https://github.com/psf/black
410
rev: 22.3.0
511
hooks:

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.2.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: 4 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,11 @@
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",
36+
"Programming Language :: Python :: 3.11",
3737
"Programming Language :: C++",
3838
"Topic :: Software Development :: Quality Assurance",
3939
"Topic :: Software Development :: Testing",

src/pytest_cpp/boost.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import io
12
import os
3+
import shutil
24
import subprocess
35
import tempfile
46
from xml.etree import ElementTree
5-
import io
6-
import shutil
7+
78
from pytest_cpp.error import CppTestFailure
89

910

src/pytest_cpp/error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import os
12
import string
23

3-
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/google.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from xml.etree import ElementTree
55

66
import pytest
7+
78
from pytest_cpp.error import CppTestFailure
89

910

src/pytest_cpp/plugin.py

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@
66
import pytest
77

88
from pytest_cpp.boost import BoostTestFacade
9-
from pytest_cpp.error import CppFailureRepr, CppFailureError
10-
from pytest_cpp.google import GoogleTestFacade
119
from pytest_cpp.catch2 import Catch2Facade
10+
from pytest_cpp.error import CppFailureError
11+
from pytest_cpp.error import CppFailureRepr
12+
from pytest_cpp.google import GoogleTestFacade
1213

1314
FACADES = [GoogleTestFacade, BoostTestFacade, Catch2Facade]
1415
DEFAULT_MASKS = ("test_*", "*_test")
1516

1617
_ARGUMENTS = "cpp_arguments"
1718

1819

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

5350
for facade_class in FACADES:
5451
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-
)
52+
return CppFile.from_parent(
53+
path=file_path,
54+
parent=parent,
55+
facade=facade_class(),
56+
arguments=test_args,
57+
)
6958

7059

7160
def pytest_addoption(parser):
@@ -115,15 +104,12 @@ def from_parent(cls, *, parent, path, facade, arguments, **kwargs):
115104

116105
def collect(self):
117106
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)
107+
yield CppItem.from_parent(
108+
parent=self,
109+
name=test_id,
110+
facade=self.facade,
111+
arguments=self._arguments,
112+
)
127113

128114

129115
class CppItem(pytest.Item):

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import os
22
import shutil
3-
import pytest
43
import sys
54

5+
import pytest
6+
67
pytest_plugins = "pytester"
78

89

tests/test_pytest_cpp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import subprocess
22
import sys
3-
from distutils.spawn import find_executable
43

54
import pytest
5+
from distutils.spawn import find_executable
66

77
from pytest_cpp import error
88
from pytest_cpp.boost import BoostTestFacade
99
from pytest_cpp.catch2 import Catch2Facade
10-
from pytest_cpp.error import CppFailureRepr, CppTestFailure
10+
from pytest_cpp.error import CppFailureRepr
11+
from pytest_cpp.error import CppTestFailure
1112
from pytest_cpp.google import GoogleTestFacade
1213

1314

0 commit comments

Comments
 (0)