summaryrefslogtreecommitdiff
path: root/coverage/plugin.py
blob: 0b557106f57933a598c544d186507e52cb2e4631 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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