diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-08-01 08:00:02 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-08-01 08:00:02 -0400 |
commit | e0fb42b64f2bfc21adff690af72a7ff5360407c8 (patch) | |
tree | 579232f6a847455c39c7a37ce0a2ff909e410134 /coverage/collector.py | |
parent | 067030f9e48367e7906d3fdae39bece5700ba1b2 (diff) | |
download | python-coveragepy-git-e0fb42b64f2bfc21adff690af72a7ff5360407c8.tar.gz |
Implement FileDisposition in C for speed. Final part of fix for #387.
Diffstat (limited to 'coverage/collector.py')
-rw-r--r-- | coverage/collector.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/coverage/collector.py b/coverage/collector.py index b8e08414..ae5f6c8b 100644 --- a/coverage/collector.py +++ b/coverage/collector.py @@ -13,7 +13,7 @@ from coverage.pytracer import PyTracer try: # Use the C extension code when we can, for speed. - from coverage.tracer import CTracer # pylint: disable=no-name-in-module + from coverage.tracer import CTracer, CFileDisposition # pylint: disable=no-name-in-module except ImportError: # Couldn't import the C extension, maybe it isn't built. if os.getenv('COVERAGE_TEST_TRACER') == 'c': @@ -30,6 +30,11 @@ except ImportError: CTracer = None +class FileDisposition(object): + """A simple value type for recording what to do with a file.""" + pass + + class Collector(object): """Collects trace data. @@ -124,7 +129,12 @@ class Collector(object): # trace function. self._trace_class = CTracer or PyTracer - self.supports_plugins = self._trace_class is CTracer + if self._trace_class is CTracer: + self.file_disposition_class = CFileDisposition + self.supports_plugins = True + else: + self.file_disposition_class = FileDisposition + self.supports_plugins = False def __repr__(self): return "<Collector at 0x%x>" % id(self) |