diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-26 08:49:00 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-26 08:49:00 -0500 |
commit | 04076715a642d0caa6436e81d35416e711b80d52 (patch) | |
tree | 4e8a7c8af5f61e07b78970fc8a587e363de5db6e | |
parent | fa62e0238a631ce0d1894ebe6311bd7c2aee0298 (diff) | |
download | python-coveragepy-git-04076715a642d0caa6436e81d35416e711b80d52.tar.gz |
COVERAGE_PROCESS_START now is the name of the rc file, and we use it to measure our own coverage.
-rw-r--r-- | allcoverage.cmd | 2 | ||||
-rw-r--r-- | covcov.ini | 12 | ||||
-rw-r--r-- | coverage/control.py | 8 | ||||
-rw-r--r-- | test/coverage_coverage.py | 9 |
4 files changed, 18 insertions, 13 deletions
diff --git a/allcoverage.cmd b/allcoverage.cmd index d80a1cf0..23fca2f3 100644 --- a/allcoverage.cmd +++ b/allcoverage.cmd @@ -2,7 +2,7 @@ make --quiet testdata
del .coverage.*
-set COVERAGE_PROCESS_START=c:\ned\coverage\trunk\.coverage
+set COVERAGE_PROCESS_START=c:\ned\coverage\trunk\covcov.ini
set COVERAGE_COVERAGE=1
call \ned\bin\switchpy 23
diff --git a/covcov.ini b/covcov.ini new file mode 100644 index 00000000..97f226d8 --- /dev/null +++ b/covcov.ini @@ -0,0 +1,12 @@ +# Settings to use when using coverage.py to measure itself.
+[run]
+branch = 1
+data_file = c:\ned\coverage\trunk\.coverage
+
+[report]
+exclude_lines =
+ # pragma: no cover
+ def __repr__
+ if __name__ == .__main__.:
+ raise AssertionError
+
diff --git a/coverage/control.py b/coverage/control.py index 415df277..94cb931f 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -382,15 +382,13 @@ def process_startup(): import coverage; coverage.process_startup() If the environment variable COVERAGE_PROCESS_START is defined, coverage - measurement is started. The value of the variable is the data file - prefix to use. + measurement is started. The value of the variable is the config file + to use. """ cps = os.environ.get("COVERAGE_PROCESS_START") if cps: - cov = coverage( - auto_data=True, data_file=cps, data_suffix=True, branch=True - ) + cov = coverage(config_file=cps, auto_data=True, data_suffix=True) if os.environ.get("COVERAGE_COVERAGE"): # Measuring coverage within coverage.py takes yet more trickery. cov.cover_prefix = "Please measure coverage.py!" diff --git a/test/coverage_coverage.py b/test/coverage_coverage.py index 6af5f377..294cc1bf 100644 --- a/test/coverage_coverage.py +++ b/test/coverage_coverage.py @@ -25,7 +25,7 @@ def run_tests_with_coverage(): version = "%s%s" % sys.version_info[:2] suffix = ".%s_%s" % (version, tracer) - cov = coverage.coverage(branch=True, data_suffix=suffix) + cov = coverage.coverage(config_file="covcov.ini", data_suffix=suffix) # Cheap trick: the coverage code itself is excluded from measurement, but # if we clobber the cover_prefix in the coverage object, we can defeat the # self-detection. @@ -63,14 +63,9 @@ def report_on_combined_files(): print(":: Writing HTML report to %s/index.html" % HTML_DIR) import coverage - cov = coverage.coverage() + cov = coverage.coverage(config_file="covcov.ini") cov.combine() cov.save() - cov.clear_exclude() - cov.exclude("# pragma: no cover") - cov.exclude("def __repr__") - cov.exclude("if __name__ == .__main__.:") - cov.exclude("raise AssertionError") cov.html_report( directory=HTML_DIR, ignore_errors=True, |