diff options
-rw-r--r-- | CHANGES.txt | 5 | ||||
-rw-r--r-- | coverage/cmdline.py | 6 | ||||
-rw-r--r-- | coverage/control.py | 15 | ||||
-rw-r--r-- | test/test_api.py | 4 |
4 files changed, 16 insertions, 14 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index e55e07a6..76fcb3cf 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,7 +11,7 @@ Version 3.0b3 - Added clear_exclude() and get_exclude_list() methods for programmatic
manipulation of the exclude regexes.
-- Added coverage.load() to
+- Added coverage.load() to read previously-saved data from the data file.
- Improved the finding of code files. For example, .pyc files that have been
installed after compiling are now located correctly. Thanks, Detlev
@@ -30,7 +30,8 @@ HTML reporting, and continued refactoring. Thanks to George Song for code, inspiration and guidance.
- Code in the Python standard library is not measured by default. If you need
- to measure standard library code, use the -L switch during execution.
+ to measure standard library code, use the -L command-line switch during
+ execution, or the cover_pylib=True argument to the coverage() constructor.
- Source annotation into a directory (-a -d) behaves differently. The
annotated files are named with their hierarchy flattened so that same-named
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 2ccd54f5..fd6101b6 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -13,7 +13,7 @@ coverage -x [-p] [-L] MODULE.py [ARG1 ARG2 ...] Execute the module, passing the given command-line arguments, collecting coverage data. With the -p option, include the machine name and process ID in the .coverage file name. With -L, measure coverage even inside the - Python standard library, which isn't done by default. + Python installed library, which isn't done by default. coverage -e Erase collected coverage data. @@ -87,7 +87,7 @@ class CoverageScript: '-e': 'erase', '-h': 'help', '-i': 'ignore-errors', - '-L': 'stdlib', + '-L': 'pylib', '-m': 'show-missing', '-p': 'parallel-mode', '-r': 'report', @@ -138,7 +138,7 @@ class CoverageScript: # Do something. self.coverage = self.covpkg.coverage( data_suffix = bool(settings.get('parallel-mode')), - cover_stdlib = settings.get('stdlib') + cover_pylib = settings.get('pylib') ) if settings.get('erase'): diff --git a/coverage/control.py b/coverage/control.py index 03837362..32e6fad3 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -14,7 +14,7 @@ class coverage: """Programmatic access to Coverage. """ - def __init__(self, data_file=None, data_suffix=False, cover_stdlib=False): + def __init__(self, data_file=None, data_suffix=False, cover_pylib=False): """Create a new coverage measurement context. `data_file` is the base name of the data file to use, defaulting to @@ -22,14 +22,15 @@ class coverage: final file name. If `data_suffix` is simply True, then a suffix is created with the machine and process identity included. - `cover_stdlib` is a boolean determining whether Python code installed - with the Python interpreter is measured. + `cover_pylib` is a boolean determining whether Python code installed + with the Python interpreter is measured. This includes the Python + standard library and any packages installed with the interpreter. """ from coverage.collector import Collector from coverage import __version__ - self.cover_stdlib = cover_stdlib + self.cover_pylib = cover_pylib self.exclude_re = "" self.exclude_list = [] @@ -80,9 +81,9 @@ class coverage: canonical = self.file_locator.canonical_filename(filename) - # If we aren't supposed to trace the stdlib, then check if this is in - # the stdlib and skip it if so. - if not self.cover_stdlib: + # If we aren't supposed to trace installed code, then check if this is + # near the Python interpreter and skip it if so. + if not self.cover_pylib: if canonical.startswith(self.sysprefix): return False diff --git a/test/test_api.py b/test/test_api.py index 68f1dc95..f19099e1 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -159,7 +159,7 @@ class ApiTest(CoverageTest): # Measure without the stdlib. cov1 = coverage.coverage() - self.assertEqual(cov1.cover_stdlib, False) + self.assertEqual(cov1.cover_pylib, False) cov1.start() self.importModule("mymain") cov1.stop() @@ -172,7 +172,7 @@ class ApiTest(CoverageTest): self.assertEqual(statements, missing) # Measure with the stdlib. - cov2 = coverage.coverage(cover_stdlib=True) + cov2 = coverage.coverage(cover_pylib=True) cov2.start() self.importModule("mymain") cov2.stop() |