Skip to content

Commit

Permalink
Merge pull request #407 from nicoddemus/pytest6-compatibility
Browse files Browse the repository at this point in the history
Require pytest >=6.2.5
  • Loading branch information
nicoddemus committed Jan 29, 2024
2 parents e6aad18 + 875f5aa commit e43ab19
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
os: [ubuntu-latest, windows-latest]
tox_env: ["py"]
include:
- python: "3.10"
os: ubuntu-latest
tox_env: "pytest6"
- python: "3.12"
os: ubuntu-latest
tox_env: "norewrite"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Releases
========

UNRELEASED
----------

* ``pytest-mock`` now requires ``pytest>=6.2.5``.

3.12.0 (2023-10-19)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"pytest_mock": ["py.typed"],
},
python_requires=">=3.8",
install_requires=["pytest>=5.0"],
install_requires=["pytest>=6.2.5"],
use_scm_version={"write_to": "src/pytest_mock/_version.py"},
setup_requires=["setuptools_scm"],
url="https://github.com/pytest-dev/pytest-mock/",
Expand Down
10 changes: 5 additions & 5 deletions tests/test_pytest_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def assert_argument_introspection(left: Any, right: Any) -> Generator[None, None
# NOTE: we assert with either verbose or not, depending on how our own
# test was run by examining sys.argv
verbose = any(a.startswith("-v") for a in sys.argv)
if int(pytest.version_tuple[0]) < 8:
if int(pytest.__version__.split(".")[0]) < 8:
expected = "\n ".join(util._compare_eq_iterable(left, right, verbose)) # type:ignore[arg-type]
else:
expected = "\n ".join(
Expand Down Expand Up @@ -888,12 +888,12 @@ def test(mocker):
"*Args:",
"*assert ('fo',) == ('',)",
"*At index 0 diff: 'fo' != ''*",
"*Use -v to get more diff*",
"*Use -v to*",
"*Kwargs:*",
"*assert {} == {'bar': 4}*",
"*Right contains* more item*",
"*{'bar': 4}*",
"*Use -v to get more diff*",
"*Use -v to*",
]
result.stdout.fnmatch_lines(expected_lines)

Expand Down Expand Up @@ -929,12 +929,12 @@ async def test(mocker):
"*Args:",
"*assert ('fo',) == ('',)",
"*At index 0 diff: 'fo' != ''*",
"*Use -v to get more diff*",
"*Use -v to*",
"*Kwargs:*",
"*assert {} == {'bar': 4}*",
"*Right contains* more item*",
"*{'bar': 4}*",
"*Use -v to get more diff*",
"*Use -v to*",
]
result.stdout.fnmatch_lines(expected_lines)

Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[tox]
minversion = 3.5.3
envlist = py{38,39,310,311,312}, norewrite
envlist = py{38,39,310,311,312}, norewrite, pytest6

[testenv]
deps =
coverage
mock
pytest-asyncio
pytest6: pytest==6.2.5
commands =
coverage run --append --source={envsitepackagesdir}/pytest_mock -m pytest tests --color=yes

Expand Down

0 comments on commit e43ab19

Please sign in to comment.