def test_auto_use_request_attributes(self, pytester, scope):
        """Check that all attributes of a request in an autouse fixture
        behave as expected when requested for a doctest item.
        """
        pytester.makeconftest(
            f"""
            import pytest

            @pytest.fixture(autouse=True, scope="{scope}")
            def auto(request):
                if "{scope}" == 'module':
                    assert request.module is None
                if "{scope}" == 'class':
                    assert request.cls is None
                if "{scope}" == 'function':
                    assert request.function is None
                return 99
        """
        )
        pytester.maketxtfile(
            test_doc="""
            >>> 1 + 1
            2
        """
        )
        result = pytester.runpytest("--doctest-modules")
        str(result.stdout.no_fnmatch_line("*FAILURES*"))
        result.stdout.fnmatch_lines(["*=== 1 passed in *"])
Check that all attributes of a request in an autouse fixture
        behave as expected when requested for a doctest item.
        
testing/test_doctest.py