diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-12 00:01:59 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-11-12 00:01:59 -0500 |
commit | d8622edb21c4c44b9e5cba6ad07d70da8383faf6 (patch) | |
tree | 56ec685292611854ab1d6737ffa5290d8f63ab67 | |
parent | 32afd146a0d3e1d8a1e8e443324cec3926306bdf (diff) | |
download | python-coveragepy-d8622edb21c4c44b9e5cba6ad07d70da8383faf6.tar.gz |
Clarify when coverage measurement actually starts. #102
-rw-r--r-- | coverage/control.py | 9 | ||||
-rw-r--r-- | doc/api.rst | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/coverage/control.py b/coverage/control.py index 20afff5..6f15bf9 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -25,7 +25,7 @@ class coverage(object): cov = coverage() cov.start() - #.. blah blah (run your code) blah blah .. + #.. call your code .. cov.stop() cov.html_report(directory='covhtml') @@ -320,7 +320,12 @@ class coverage(object): self.data.read() def start(self): - """Start measuring code coverage.""" + """Start measuring code coverage. + + Coverage measurement actually occurs in functions called after `start` + is invoked. Statements in the same scope as `start` won't be measured. + + """ if self.run_suffix: # Calling start() means we're running code, so use the run_suffix # as the data_suffix when we eventually save the data. diff --git a/doc/api.rst b/doc/api.rst index 09b94af..9ce1ee1 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -8,6 +8,7 @@ Coverage API :history: 20090613T164000, final touches for 3.0 :history: 20100221T151500, docs for 3.3 (on the plane back from PyCon) :history: 20100725T211700, updated for 3.4. +:history: 20121111T235800, added a bit of clarification. The API to coverage.py is very simple, contained in a single module called @@ -20,11 +21,13 @@ in the command line interface. For example, a simple use would be:: cov = coverage.coverage() cov.start() - # .. run your code .. + # .. call your code .. cov.stop() cov.save() + cov.html_report() + The coverage module ------------------- |