Skip to content

Commit

Permalink
Merge pull request #8 from blueyed/handle-VersionConflict
Browse files Browse the repository at this point in the history
Handle VersionConflict in `load_setuptools_entrypoints`
  • Loading branch information
hpk42 committed Sep 22, 2015
2 parents f8b0f34 + 6d009de commit 038cbf2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pluggy.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ def check_pending(self):
def load_setuptools_entrypoints(self, entrypoint_name):
""" Load modules from querying the specified setuptools entrypoint name.
Return the number of loaded plugins. """
from pkg_resources import iter_entry_points, DistributionNotFound
from pkg_resources import (iter_entry_points, DistributionNotFound,
VersionConflict)
for ep in iter_entry_points(entrypoint_name):
# is the plugin registered or blocked?
if self.get_plugin(ep.name) or self.is_blocked(ep.name):
Expand All @@ -502,6 +503,9 @@ def load_setuptools_entrypoints(self, entrypoint_name):
plugin = ep.load()
except DistributionNotFound:
continue
except VersionConflict as e:
raise PluginValidationError(
"Plugin %r could not be loaded: %s!" % (ep.name, e))
self.register(plugin, name=ep.name)
self._plugin_distinfo.append((plugin, ep.dist))
return len(self._plugin_distinfo)
Expand Down

0 comments on commit 038cbf2

Please sign in to comment.