summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <nedbat@gmail.com>2014-10-01 07:32:19 -0400
committerNed Batchelder <nedbat@gmail.com>2014-10-01 07:32:19 -0400
commit9af6bd3df6db9288199b2dbf9e243d14e6dc6e01 (patch)
treece58d9307ea15167ffb9e8b40fa9e743bd430c04 /coverage/control.py
parent866c1262f241641768c21f328048164fe56ca331 (diff)
parentdb8836e5d6c69b8861b1e5ffaf90e8215c02cad2 (diff)
downloadpython-coveragepy-9af6bd3df6db9288199b2dbf9e243d14e6dc6e01.tar.gz
Merged in alex_gaynor/coveragepy/alex_gaynor/improve-performance-of-coverage-under-py-1411425050845 (pull request #40)
Improve performance of coverage under PyPy.
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 86a2ae2..b2ec64a 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -45,7 +45,7 @@ class Coverage(object):
def __init__(self, data_file=None, data_suffix=None, cover_pylib=None,
auto_data=False, timid=None, branch=None, config_file=True,
source=None, omit=None, include=None, debug=None,
- debug_file=None, coroutine=None, plugins=None):
+ debug_file=None, concurrency=None, plugins=None):
"""
`data_file` is the base name of the data file to use, defaulting to
".coverage". `data_suffix` is appended (with a dot) to `data_file` to
@@ -84,10 +84,10 @@ class Coverage(object):
desired. `debug_file` is the file to write debug messages to,
defaulting to stderr.
- `coroutine` is a string indicating the coroutining library being used
+ `concurrency` is a string indicating the concurrency library being used
in the measured code. Without this, coverage.py will get incorrect
- results. Valid strings are "greenlet", "eventlet", or "gevent", which
- are all equivalent. TODO: really?
+ results. Valid strings are "greenlet", "eventlet", "gevent", or
+ "thread" (the default).
`plugins` TODO.
@@ -118,7 +118,6 @@ class Coverage(object):
self.config.from_file("setup.cfg", section_prefix="coverage:")
# 3: from environment variables:
- self.config.from_environment('COVERAGE_OPTIONS')
env_data_file = os.environ.get('COVERAGE_FILE')
if env_data_file:
self.config.data_file = env_data_file
@@ -128,7 +127,7 @@ class Coverage(object):
data_file=data_file, cover_pylib=cover_pylib, timid=timid,
branch=branch, parallel=bool_or_none(data_suffix),
source=source, omit=omit, include=include, debug=debug,
- coroutine=coroutine, plugins=plugins,
+ concurrency=concurrency, plugins=plugins,
)
# Create and configure the debugging controller.
@@ -170,7 +169,7 @@ class Coverage(object):
timid=self.config.timid,
branch=self.config.branch,
warn=self._warn,
- coroutine=self.config.coroutine,
+ concurrency=self.config.concurrency,
)
# Suffixes are a bit tricky. We want to use the data suffix only when
@@ -551,10 +550,9 @@ class Coverage(object):
# `save()` at the last minute so that the pid will be correct even
# if the process forks.
extra = ""
- if _TEST_NAME_FILE:
- f = open(_TEST_NAME_FILE)
- test_name = f.read()
- f.close()
+ if _TEST_NAME_FILE: # pragma: debugging
+ with open(_TEST_NAME_FILE) as f:
+ test_name = f.read()
extra = "." + test_name
data_suffix = "%s%s.%s.%06d" % (
socket.gethostname(), extra, os.getpid(),