Skip to content

NotImplementedError in pkg_resources with pytest 2.4 #366

@pytestbot

Description

@pytestbot

Originally reported by: Jason R. Coombs (BitBucket: jaraco, GitHub: jaraco)


In our tests, we have this fixture:

@pytest.fixture
def EMEA_options():
    options_stream = pkg_resources.resource_stream(__name__,
        'EMEA exporter options.yaml')
    return yaml.load(options_stream)['exporter_options']

Beginning with pytest 2.4.1 (maybe 2.4), we started seeing this error when the fixture runs:

NotImplementedError: Can't perform this operation for loaders without 'get_data()

That error occurs in pkg_resources (part of setuptools 1.1.6) because the NullProvider is selected instead of the EggProvider (the package is installed using 'develop').

With pytest 2.3.5, the EggProvider is elected.

The apparent reason is that in pytest 2.4, the __loader__ of the package in question is:

(Pdb) __loader__
<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x482e850>

So it seems the __loader__ is being wrapped in an AssertionRewritingHook, which causes pkg_resources to identify it incorrectly, and thus not use the EggProvider.

I'm hoping this regression is an unintentional oversight and easily corrected. Please let me know if I can provide more detail to help resolve the issue.


Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions