Skip to content

Commit

Permalink
fix for Pytest 8 compat (#17066)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mr-c authored Mar 26, 2024
1 parent 99f4b81 commit bebd278
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
4 changes: 1 addition & 3 deletions mypy/test/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,7 @@ def pytest_pycollect_makeitem(collector: Any, name: str, obj: object) -> Any | N
# Non-None result means this obj is a test case.
# The collect method of the returned DataSuiteCollector instance will be called later,
# with self.obj being obj.
return DataSuiteCollector.from_parent( # type: ignore[no-untyped-call]
parent=collector, name=name
)
return DataSuiteCollector.from_parent(parent=collector, name=name)
return None


Expand Down
2 changes: 1 addition & 1 deletion mypy/test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def run_mypy(args: list[str]) -> None:
if status != 0:
sys.stdout.write(outval)
sys.stderr.write(errval)
pytest.fail(msg="Sample check failed", pytrace=False)
pytest.fail(reason="Sample check failed", pytrace=False)


def diff_ranges(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ extra-standard-library = ["typing_extensions"]
ignore = ["**/.readthedocs.yaml"]

[tool.pytest.ini_options]
minversion = "6.0.0"
minversion = "7.0.0"
testpaths = ["mypy/test", "mypyc/test"]
python_files = 'test*.py'

Expand Down
2 changes: 1 addition & 1 deletion test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ lxml>=4.9.1,<4.9.3; (python_version<'3.11' or sys_platform!='win32') and python_
pre-commit
pre-commit-hooks==4.5.0
psutil>=4.0
pytest>=7.4.0
pytest>=8.1.0
pytest-xdist>=1.34.0
pytest-cov>=2.10.0
ruff==0.2.0 # must match version in .pre-commit-config.yaml
Expand Down
4 changes: 2 additions & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ platformdirs==3.11.0
# via
# black
# virtualenv
pluggy==1.3.0
pluggy==1.4.0
# via pytest
pre-commit==3.5.0
# via -r test-requirements.in
pre-commit-hooks==4.5.0
# via -r test-requirements.in
psutil==5.9.6
# via -r test-requirements.in
pytest==7.4.2
pytest==8.1.1
# via
# -r test-requirements.in
# pytest-cov
Expand Down

0 comments on commit bebd278

Please sign in to comment.