diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-10-19 11:51:26 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-10-19 11:51:26 -0400 |
commit | cd015c45c278aca757263746ed2e64c46d578ddd (patch) | |
tree | b1e1e0636082dd1d28605048a2f268a11e9555cd /coverage/codeunit.py | |
parent | 2150bdc270fa92d56a2fadea4c8d1f76fe6ab531 (diff) | |
download | python-coveragepy-git-cd015c45c278aca757263746ed2e64c46d578ddd.tar.gz |
More plugin re-shaping
Diffstat (limited to 'coverage/codeunit.py')
-rw-r--r-- | coverage/codeunit.py | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/coverage/codeunit.py b/coverage/codeunit.py index c9ab2622..da617913 100644 --- a/coverage/codeunit.py +++ b/coverage/codeunit.py @@ -32,24 +32,16 @@ def code_unit_factory(morfs, file_locator, get_plugin=None): if isinstance(morf, string_class) and get_plugin: plugin = get_plugin(morf) if plugin: - klass = plugin.code_unit_class(morf) - #klass = DjangoTracer # NOT REALLY! TODO - # Hacked-in Mako support. Define COVERAGE_MAKO_PATH as a fragment of - # the path that indicates the Python file is actually a compiled Mako - # template. THIS IS TEMPORARY! - #MAKO_PATH = os.environ.get('COVERAGE_MAKO_PATH') - #if MAKO_PATH and isinstance(morf, string_class) and MAKO_PATH in morf: - # # Super hack! Do mako both ways! - # if 0: - # cu = PythonCodeUnit(morf, file_locator) - # cu.name += '_fako' - # code_units.append(cu) - # klass = MakoCodeUnit - #elif isinstance(morf, string_class) and morf.endswith(".html"): - # klass = DjangoCodeUnit + file_reporter = plugin.file_reporter(morf) + if file_reporter is None: + raise CoverageException( + "Plugin %r did not provide a file reporter for %r." % ( + plugin.plugin_name, morf + ) + ) else: - klass = PythonCodeUnit - code_units.append(klass(morf, file_locator)) + file_reporter = PythonCodeUnit(morf, file_locator) + code_units.append(file_reporter) return code_units |