diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2015-07-14 08:47:00 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2015-07-14 08:47:00 +0200 |
commit | 083b8d949d7a7954e7e2ccb1c4c19778cb8d7c3e (patch) | |
tree | 61f66436666de8a3f2515f0e00ec4793c15b24de /Cython/Coverage.py | |
parent | 82aed5cdd1a8c5bd37cdf752782879fc1c57e94e (diff) | |
download | cython-083b8d949d7a7954e7e2ccb1c4c19778cb8d7c3e.tar.gz |
adapt coverage plugin to new API in coverage.py 4.0a7, minor changes
Diffstat (limited to 'Cython/Coverage.py')
-rw-r--r-- | Cython/Coverage.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Cython/Coverage.py b/Cython/Coverage.py index 20f45a6d2..e778db1fd 100644 --- a/Cython/Coverage.py +++ b/Cython/Coverage.py @@ -4,6 +4,8 @@ A Cython plugin for coverage.py Requires the coverage package at least in version 4.0 (which added the plugin API). """ +from __future__ import absolute_import + import re import os.path from collections import defaultdict @@ -235,7 +237,7 @@ class CythonModuleTracer(FileTracer): pass abs_path = os.path.abspath(source_file) - if self.py_file and source_file.lower().endswith('.py'): + if self.py_file and source_file[-3:].lower() == '.py': # always let coverage.py handle this case itself self._file_path_map[source_file] = self.py_file return self.py_file @@ -286,3 +288,7 @@ class CythonModuleReporter(FileReporter): else: for line in self._iter_source_tokens(): yield [('txt', line)] + + +def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) |