def test_hook_not_called_without_cmd_option(
        self, pytester: Pytester, monkeypatch
    ) -> None:
        """Assertion pass should not be called (and hence formatting should
        not occur) if there is no hook declared for pytest_assertion_pass"""

        def raise_on_assertionpass(*_, **__):
            raise Exception("Assertion passed called when it shouldn't!")

        monkeypatch.setattr(
            _pytest.assertion.rewrite, "_call_assertion_pass", raise_on_assertionpass
        )

        pytester.makeconftest(
            """\
            def pytest_assertion_pass(item, lineno, orig, expl):
                raise Exception("Assertion Passed: {} {} at line {}".format(orig, expl, lineno))
            """
        )

        pytester.makepyfile(
            """\
            def test_simple():
                a=1
                b=2
                c=3
                d=0

                assert a+b == c+d
            """
        )
        result = pytester.runpytest()
        result.assert_outcomes(passed=1)
Assertion pass should not be called (and hence formatting should
        not occur) if there is no hook declared for pytest_assertion_pass
testing/test_assertrewrite.py