@@ -124,6 +124,8 @@ def pytest_runtest_protocol(item: Item) -> Generator[None, None, None]:
124
124
comparison for the test.
125
125
"""
126
126
127
+ ihook = item .ihook
128
+
127
129
def callbinrepr (op , left : object , right : object ) -> Optional [str ]:
128
130
"""Call the pytest_assertrepr_compare hook and prepare the result
129
131
@@ -139,7 +141,7 @@ def callbinrepr(op, left: object, right: object) -> Optional[str]:
139
141
The result can be formatted by util.format_explanation() for
140
142
pretty printing.
141
143
"""
142
- hook_result = item . ihook .pytest_assertrepr_compare (
144
+ hook_result = ihook .pytest_assertrepr_compare (
143
145
config = item .config , op = op , left = left , right = right
144
146
)
145
147
for new_expl in hook_result :
@@ -155,12 +157,10 @@ def callbinrepr(op, left: object, right: object) -> Optional[str]:
155
157
saved_assert_hooks = util ._reprcompare , util ._assertion_pass
156
158
util ._reprcompare = callbinrepr
157
159
158
- if item . ihook .pytest_assertion_pass .get_hookimpls ():
160
+ if ihook .pytest_assertion_pass .get_hookimpls ():
159
161
160
162
def call_assertion_pass_hook (lineno : int , orig : str , expl : str ) -> None :
161
- item .ihook .pytest_assertion_pass (
162
- item = item , lineno = lineno , orig = orig , expl = expl
163
- )
163
+ ihook .pytest_assertion_pass (item = item , lineno = lineno , orig = orig , expl = expl )
164
164
165
165
util ._assertion_pass = call_assertion_pass_hook
166
166
0 commit comments