Skip to content

Commit 0577f1a

Browse files
committed
Fix assertion checks for pytest 7
1 parent 6f4a21c commit 0577f1a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/test_pytest_mock.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import platform
33
import re
44
import sys
5+
import warnings
56
from contextlib import contextmanager
67
from typing import Any
78
from typing import Callable
@@ -758,12 +759,12 @@ def test(mocker):
758759
"*Args:",
759760
"*assert ('fo',) == ('',)",
760761
"*At index 0 diff: 'fo' != ''*",
761-
"*Use -v to get the full diff*",
762+
"*Use -v to get more diff*",
762763
"*Kwargs:*",
763764
"*assert {} == {'bar': 4}*",
764765
"*Right contains* more item*",
765766
"*{'bar': 4}*",
766-
"*Use -v to get the full diff*",
767+
"*Use -v to get more diff*",
767768
]
768769
result.stdout.fnmatch_lines(expected_lines)
769770

@@ -799,12 +800,12 @@ async def test(mocker):
799800
"*Args:",
800801
"*assert ('fo',) == ('',)",
801802
"*At index 0 diff: 'fo' != ''*",
802-
"*Use -v to get the full diff*",
803+
"*Use -v to get more diff*",
803804
"*Kwargs:*",
804805
"*assert {} == {'bar': 4}*",
805806
"*Right contains* more item*",
806807
"*{'bar': 4}*",
807-
"*Use -v to get the full diff*",
808+
"*Use -v to get more diff*",
808809
]
809810
result.stdout.fnmatch_lines(expected_lines)
810811

@@ -929,7 +930,7 @@ def doIt(self):
929930

930931
a = A()
931932

932-
with pytest.warns(None) as warn_record:
933+
with warnings.catch_warnings(record=True) as warn_record:
933934
with mocker.patch.context_manager(a, "doIt", return_value=True):
934935
assert a.doIt() is True
935936

0 commit comments

Comments
 (0)