'Attempts to load resources from a package should succeed normally,
even when the AssertionRewriteHook is used to load the modules.
See #366 for details.'

def test_resources_provider_for_loader(self, testdir):

    pytest.importorskip('pkg_resources')
    testdir.mkpydir('testpkg')
    contents = {'testpkg/test_pkg': "\n                                                                import    pkg_resources\n\n                                                                import    pytest\n                                                                from    _pytest.assertion.rewrite    import    AssertionRewritingHook\n\n                                                                def    test_load_resource():\n                                                                                assert    isinstance(__loader__,    AssertionRewritingHook)\n                                                                                res    =    pkg_resources.resource_string(__name__,    'resource.txt')\n                                                                                res    =    res.decode('ascii')\n                                                                                assert    res    ==    'Load    me    please.'\n                                                                "}
    testdir.makepyfile(**contents)
    testdir.maketxtfile(**{'testpkg/resource': 'Load    me    please.'})
    result = testdir.runpytest_subprocess()
    result.assert_outcomes(passed=1)
