Skip to content

Commit 038cbf2

Browse files
committed
Merge pull request #8 from blueyed/handle-VersionConflict
Handle VersionConflict in `load_setuptools_entrypoints`
2 parents f8b0f34 + 6d009de commit 038cbf2

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
@@ -493,7 +493,8 @@ def check_pending(self):
493493
def load_setuptools_entrypoints(self, entrypoint_name):
494494
""" Load modules from querying the specified setuptools entrypoint name.
495495
Return the number of loaded plugins. """
496-
from pkg_resources import iter_entry_points, DistributionNotFound
496+
from pkg_resources import (iter_entry_points, DistributionNotFound,
497+
VersionConflict)
497498
for ep in iter_entry_points(entrypoint_name):
498499
# is the plugin registered or blocked?
499500
if self.get_plugin(ep.name) or self.is_blocked(ep.name):
@@ -502,6 +503,9 @@ def load_setuptools_entrypoints(self, entrypoint_name):
502503
plugin = ep.load()
503504
except DistributionNotFound:
504505
continue
506+
except VersionConflict as e:
507+
raise PluginValidationError(
508+
"Plugin %r could not be loaded: %s!" % (ep.name, e))
505509
self.register(plugin, name=ep.name)
506510
self._plugin_distinfo.append((plugin, ep.dist))
507511
return len(self._plugin_distinfo)

0 commit comments

Comments
 (0)