summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-11-28 20:24:23 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-11-28 20:24:23 -0500
commitc72bfe70f9f8ac6d573689798b364bd664b93444 (patch)
treed356597357f024c6e252c8fc47137b74e42b8bc2 /coverage
parent49ede2bdf54a12e4eaa9472785cc5544040c077a (diff)
downloadpython-coveragepy-git-c72bfe70f9f8ac6d573689798b364bd664b93444.tar.gz
Add data_file to the .coveragerc file.
--HG-- branch : config
Diffstat (limited to 'coverage')
-rw-r--r--coverage/config.py3
-rw-r--r--coverage/control.py5
-rw-r--r--coverage/data.py7
3 files changed, 9 insertions, 6 deletions
diff --git a/coverage/config.py b/coverage/config.py
index e95b74eb..125121b8 100644
--- a/coverage/config.py
+++ b/coverage/config.py
@@ -11,6 +11,7 @@ class CoverageConfig(object):
self.timid = False
self.branch = False
self.exclude_list = ['# *pragma[: ]*[nN][oO] *[cC][oO][vV][eE][rR]']
+ self.data_file = ".coverage"
def from_environment(self, env_var):
# Timidity: for nose users, read an environment variable. This is a
@@ -39,3 +40,5 @@ class CoverageConfig(object):
# Exclude is a list of lines, leave out the blank ones.
exclude_list = cp.get('report', 'exclude')
self.exclude_list = filter(None, exclude_list.split('\n'))
+ if cp.has_option('run', 'data_file'):
+ self.data_file = cp.get('run', 'data_file')
diff --git a/coverage/control.py b/coverage/control.py
index 121f52b7..77678543 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -68,7 +68,8 @@ class coverage(object):
self.config.from_file(config_file)
self.config.from_environment('COVERAGE_OPTIONS')
self.config.from_args(
- cover_pylib=cover_pylib, timid=timid, branch=branch
+ data_file=data_file, cover_pylib=cover_pylib, timid=timid,
+ branch=branch
)
self.auto_data = auto_data
@@ -92,7 +93,7 @@ class coverage(object):
data_suffix = None
self.data = CoverageData(
- basename=data_file, suffix=data_suffix,
+ basename=self.config.data_file, suffix=data_suffix,
collector="coverage v%s" % __version__
)
diff --git a/coverage/data.py b/coverage/data.py
index 452ce73d..55ed7a3a 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -2,7 +2,7 @@
import os
-from coverage.backward import pickle, sorted # pylint: disable-msg=W0622
+from coverage.backward import pickle, sorted # pylint: disable-msg=W0622
class CoverageData(object):
@@ -39,14 +39,13 @@ class CoverageData(object):
`collector` is a string describing the coverage measurement software.
"""
- self.collector = collector
+ self.collector = collector or 'unknown'
self.use_file = True
# Construct the filename that will be used for data file storage, if we
# ever do any file storage.
- self.filename = (basename or
- os.environ.get(self.filename_env, self.filename_default))
+ self.filename = basename or ".coverage"
if suffix:
self.filename += suffix
self.filename = os.path.abspath(self.filename)