Skip to content

Commit bebd278

Browse files
authored
fix for Pytest 8 compat (#17066)
In Debian, we upgraded to pytest version 8.1.1+ for the next release. pytest deprecated the name for the first positional argument to `pytest.fail` from `msg` to `reason` in Pytest 7.0 and removed `msg` in Pytest 8.0 https://docs.pytest.org/en/7.0.x/reference/reference.html#pytest-fail https://docs.pytest.org/en/8.0.x/changelog.html#old-deprecations-are-now-errors
1 parent 99f4b81 commit bebd278

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

mypy/test/data.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,7 @@ def pytest_pycollect_makeitem(collector: Any, name: str, obj: object) -> Any | N
640640
# Non-None result means this obj is a test case.
641641
# The collect method of the returned DataSuiteCollector instance will be called later,
642642
# with self.obj being obj.
643-
return DataSuiteCollector.from_parent( # type: ignore[no-untyped-call]
644-
parent=collector, name=name
645-
)
643+
return DataSuiteCollector.from_parent(parent=collector, name=name)
646644
return None
647645

648646

mypy/test/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def run_mypy(args: list[str]) -> None:
4141
if status != 0:
4242
sys.stdout.write(outval)
4343
sys.stderr.write(errval)
44-
pytest.fail(msg="Sample check failed", pytrace=False)
44+
pytest.fail(reason="Sample check failed", pytrace=False)
4545

4646

4747
def diff_ranges(

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ extra-standard-library = ["typing_extensions"]
8888
ignore = ["**/.readthedocs.yaml"]
8989

9090
[tool.pytest.ini_options]
91-
minversion = "6.0.0"
91+
minversion = "7.0.0"
9292
testpaths = ["mypy/test", "mypyc/test"]
9393
python_files = 'test*.py'
9494

test-requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ lxml>=4.9.1,<4.9.3; (python_version<'3.11' or sys_platform!='win32') and python_
1111
pre-commit
1212
pre-commit-hooks==4.5.0
1313
psutil>=4.0
14-
pytest>=7.4.0
14+
pytest>=8.1.0
1515
pytest-xdist>=1.34.0
1616
pytest-cov>=2.10.0
1717
ruff==0.2.0 # must match version in .pre-commit-config.yaml

test-requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ platformdirs==3.11.0
4444
# via
4545
# black
4646
# virtualenv
47-
pluggy==1.3.0
47+
pluggy==1.4.0
4848
# via pytest
4949
pre-commit==3.5.0
5050
# via -r test-requirements.in
5151
pre-commit-hooks==4.5.0
5252
# via -r test-requirements.in
5353
psutil==5.9.6
5454
# via -r test-requirements.in
55-
pytest==7.4.2
55+
pytest==8.1.1
5656
# via
5757
# -r test-requirements.in
5858
# pytest-cov

0 commit comments

Comments
 (0)