Skip to content

Commit

Permalink
Handle VersionConflict in load_setuptools_entrypoints
Browse files Browse the repository at this point in the history
Ref: #7
  • Loading branch information
blueyed committed Sep 11, 2015
1 parent e802d47 commit 6d009de
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 @@ -492,7 +492,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 @@ -501,6 +502,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 6d009de

Please sign in to comment.