Skip to content

Commit 6d009de

Browse files
committed
Handle VersionConflict in load_setuptools_entrypoints
Ref: #7
1 parent e802d47 commit 6d009de

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pluggy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,8 @@ def check_pending(self):
492492
def load_setuptools_entrypoints(self, entrypoint_name):
493493
""" Load modules from querying the specified setuptools entrypoint name.
494494
Return the number of loaded plugins. """
495-
from pkg_resources import iter_entry_points, DistributionNotFound
495+
from pkg_resources import (iter_entry_points, DistributionNotFound,
496+
VersionConflict)
496497
for ep in iter_entry_points(entrypoint_name):
497498
# is the plugin registered or blocked?
498499
if self.get_plugin(ep.name) or self.is_blocked(ep.name):
@@ -501,6 +502,9 @@ def load_setuptools_entrypoints(self, entrypoint_name):
501502
plugin = ep.load()
502503
except DistributionNotFound:
503504
continue
505+
except VersionConflict as e:
506+
raise PluginValidationError(
507+
"Plugin %r could not be loaded: %s!" % (ep.name, e))
504508
self.register(plugin, name=ep.name)
505509
self._plugin_distinfo.append((plugin, ep.dist))
506510
return len(self._plugin_distinfo)

0 commit comments

Comments
 (0)