def test_setup_module(self, pytester: Pytester) -> None:
        """Regression test for #12011 - setup_module not executed when running
        with `--doctest-modules`."""
        pytester.makepyfile(
            """
            CONSTANT = 0

            def setup_module():
                global CONSTANT
                CONSTANT = 1

            def test():
                assert CONSTANT == 1
            """
        )
        result = pytester.runpytest("--doctest-modules")
        assert result.ret == 0
        result.assert_outcomes(passed=1)
Regression test for #12011 - setup_module not executed when running
        with `--doctest-modules`.
testing/test_doctest.py