Skip to content

Needs to handle VersionConflict in consider_setuptools_entrypoints #704

Closed
@pytestbot

Description

@pytestbot

Originally reported by: Daniel Hahler (BitBucket: blueyed, GitHub: blueyed)


I was getting the following error, caused by the testmon plugin, which
requires pytest<2.7:

…/pyenv/project2/lib/python2.7/site-packages/_pytest/config.py in _preparse(self, args, addopts)
    711         self._checkversion()
    712         self.pluginmanager.consider_preparse(args)
--> 713         self.pluginmanager.consider_setuptools_entrypoints()
    714         self.pluginmanager.consider_env()
    715         self.known_args_namespace = ns = self._parser.parse_known_args(args)

…/pyenv/project2/lib/python2.7/site-packages/_pytest/core.py in consider_setuptools_entrypoints(self)
    276                 continue
    277             try:
--> 278                 plugin = ep.load()
    279             except DistributionNotFound:
    280                 continue

…/pyenv/project2/lib/python2.7/site-packages/pkg_resources/__init__.py in load(self, require, *args, **kwargs)
   2318             )
   2319         if require:
-> 2320             self.require(*args, **kwargs)
   2321         return self.resolve()
   2322 

…/pyenv/project2/lib/python2.7/site-packages/pkg_resources/__init__.py in require(self, env, installer)
   2335             raise UnknownExtra("Can't require() without a distribution", self)
   2336         reqs = self.dist.requires(self.extras)
-> 2337         items = working_set.resolve(reqs, env, installer)
   2338         list(map(working_set.add, items))
   2339 

…/pyenv/project2/lib/python2.7/site-packages/pkg_resources/__init__.py in resolve(self, requirements, env, installer, replace_conflicting)
    812                 dependent_req = required_by[req]
    813                 import ipdb; ipdb.set_trace()  # noqa
--> 814                 raise VersionConflict(dist, req).with_context(dependent_req)
    815 
    816             # push the new requirements onto the stack

VersionConflict: (pytest 2.7.0 (…/pyenv/project2/lib/python2.7/site-packages), Requirement.parse('pytest<2.7'))


ipdb> args
self = <pkg_resources.WorkingSet object at 0x7f3ec2a55cd0>
requirements = [Requirement.parse('pathtools>=0.1.1'), Requirement.parse('argh>=0.24.1'), Requirement.parse('PyYAML>=3.10'), Requirement.parse('execnet>=1.1.dev1'), Requ
irement.parse('pytest>=2.2')]                                                                                                                                            env = None
installer = None
replace_conflicting = False

ep is EntryPoint.parse('testmon = testmon.plugin').

It would be nice if there was a warning in such a case and the plugin was
skipped.

A warning might be useful with the current handling of DistributionNotFound,
too.


Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueeasy issue that is friendly to new contributortype: 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