'Check that all attributes of a request in an autouse fixture
behave as expected when requested for a doctest item.'

@pytest.mark.parametrize('scope', SCOPES)
def test_auto_use_request_attributes(self, testdir, scope):

    testdir.makeconftest('\n                                                import    pytest\n\n                                                @pytest.fixture(autouse=True,    scope="{scope}")\n                                                def    auto(request):\n                                                                if    "{scope}"    ==    \'module\':\n                                                                                assert    request.module    is    None\n                                                                if    "{scope}"    ==    \'class\':\n                                                                                assert    request.cls    is    None\n                                                                if    "{scope}"    ==    \'function\':\n                                                                                assert    request.function    is    None\n                                                                return    99\n                                '.format(scope=scope))
    testdir.maketxtfile(test_doc='\n                                                >>>    1    +    1\n                                                2\n                                ')
    result = testdir.runpytest('--doctest-modules')
    assert ('FAILURES' not in str(result.stdout.str()))
    result.stdout.fnmatch_lines(['*===    1    passed    in    *'])
