summaryrefslogtreecommitdiff
path: root/coverage/plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/plugin.py')
-rw-r--r--coverage/plugin.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/coverage/plugin.py b/coverage/plugin.py
new file mode 100644
index 0000000..0b55710
--- /dev/null
+++ b/coverage/plugin.py
@@ -0,0 +1,20 @@
+"""Plugin management for coverage.py"""
+
+def load_plugins(modules, name):
+ """Load plugins from `modules`, finding them by `name`.
+
+ Yields the loaded plugins.
+
+ """
+
+ for module in modules:
+ try:
+ __import__(module)
+ mod = sys.modules[module]
+ except ImportError:
+ blah()
+ continue
+
+ entry = getattr(mod, name, None)
+ if entry:
+ yield entry