'Test that auto-use fixtures work properly with doctest modules.
See #1057 and #1100.'

@pytest.mark.parametrize('scope', SCOPES)
@pytest.mark.parametrize('enable_doctest', [True, False])
def test_fixture_scopes(self, testdir, scope, enable_doctest):

    testdir.makeconftest('\n                                                import    pytest\n\n                                                @pytest.fixture(autouse=True,    scope="{scope}")\n                                                def    auto(request):\n                                                                return    99\n                                '.format(scope=scope))
    testdir.makepyfile(test_1='\n                                                def    test_foo():\n                                                                """\n                                                                >>>    getfixture(\'auto\')    +    1\n                                                                100\n                                                                """\n                                                def    test_bar():\n                                                                assert    1\n                                ')
    params = (('--doctest-modules',) if enable_doctest else ())
    passes = (3 if enable_doctest else 2)
    result = testdir.runpytest(*params)
    result.stdout.fnmatch_lines([('*===    %d    passed    in    *' % passes)])
