Skip to content

Commit 6da5b05

Browse files
authored
Update expected message to match python 3.11.7 (#404)
python/cpython#111019 Fixes #401. Closes #403.
1 parent c596504 commit 6da5b05

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/test_pytest_mock.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
# Python 3.8 changed the output formatting (bpo-35500), which has been ported to mock 3.0
2727
NEW_FORMATTING = sys.version_info >= (3, 8)
28+
# Python 3.11.7 changed the output formatting, https://github.com/python/cpython/issues/111019
29+
NEWEST_FORMATTING = sys.version_info >= (3, 11, 7)
2830

2931
if sys.version_info[:2] >= (3, 8):
3032
from unittest.mock import AsyncMock
@@ -240,7 +242,9 @@ def test_repr_with_name(self, mocker: MockerFixture) -> None:
240242

241243
def __test_failure_message(self, mocker: MockerFixture, **kwargs: Any) -> None:
242244
expected_name = kwargs.get("name") or "mock"
243-
if NEW_FORMATTING:
245+
if NEWEST_FORMATTING:
246+
msg = "expected call not found.\nExpected: {0}()\n Actual: not called."
247+
elif NEW_FORMATTING:
244248
msg = "expected call not found.\nExpected: {0}()\nActual: not called."
245249
else:
246250
msg = "Expected call: {0}()\nNot called"

0 commit comments

Comments
 (0)