diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-05-09 20:46:58 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-05-09 20:46:58 -0400 |
commit | 1f7fcec9352691a6e7a90c20e13dc59b65865030 (patch) | |
tree | cb24410520bf6cd1060eb08060bbb11ce75a0316 /test/coveragetest.py | |
parent | 30ddcc968a6654f5cdb5ccce6d7f1490ff4995b5 (diff) | |
download | python-coveragepy-git-1f7fcec9352691a6e7a90c20e13dc59b65865030.tar.gz |
More docstrings all around.
Diffstat (limited to 'test/coveragetest.py')
-rw-r--r-- | test/coveragetest.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/test/coveragetest.py b/test/coveragetest.py index 5e2c18dc..46572c56 100644 --- a/test/coveragetest.py +++ b/test/coveragetest.py @@ -14,14 +14,14 @@ import coverage class Tee(object): - """A file-like that writes to all the file-likes it was constructed with. - - """ + """A file-like that writes to all the file-likes it has.""" def __init__(self, *files): + """Make a Tee that writes to all the files in `files.`""" self.files = files def write(self, data): + """Write `data` to all the files.""" for f in self.files: f.write(data) @@ -77,8 +77,7 @@ class CoverageTest(unittest.TestCase): f.close() def importModule(self, modname): - """ Import the module named modname, and return the module object. - """ + """Import the module named modname, and return the module object.""" modfile = modname + '.py' f = open(modfile, 'r') @@ -94,6 +93,7 @@ class CoverageTest(unittest.TestCase): return mod def getModuleName(self): + """Return the module name to use for this test run.""" # We append self.n because otherwise two calls in one test will use the # same filename and whether the test works or not depends on the # timestamps in the .pyc file, so it becomes random whether the second @@ -103,6 +103,14 @@ class CoverageTest(unittest.TestCase): return modname def checkCoverage(self, text, lines, missing="", excludes=None, report=""): + """Check the coverage measurement of `text`. + + The source `text` is run and measured. `lines` are the line numbers + that are executable, `missing` are the lines not executed, `excludes` + are regexes to match against for excluding lines, and `report` is + the text of the measurement report. + + """ # We write the code into a file so that we can import it. # Coverage wants to deal with things as modules with file names. modname = self.getModuleName() |