diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 2c908133d..08813c4dc 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -685,8 +685,9 @@ class TestAssertionRewrite: assert msg is not None assert " < 0" in msg - def test_assert_handling_raise_in__iter__(self) -> None: - def f() -> None: + def test_assert_handling_raise_in__iter__(self, pytester: Pytester) -> None: + pytester.makepyfile( + """\ class A: def __iter__(self): raise ValueError() @@ -698,10 +699,10 @@ class TestAssertionRewrite: return "" assert A() == A() - - msg = getmsg(f) - assert msg is not None - assert " == " in msg + """ + ) + result = pytester.runpytest() + result.stdout.fnmatch_lines(["*E*assert == "]) def test_formatchar(self) -> None: def f() -> None: