diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-22 21:55:45 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-22 21:55:45 -0500 |
| commit | 7fd0385cfa5b776b4c7b10c4ff077296db005c49 (patch) | |
| tree | 37567b269a2491eed276dc725234fade3d2bb0f2 /tests/plugin2.py | |
| parent | 1b04c715aa30a2e2a4cf3f6c3d0b65b93363c83d (diff) | |
| parent | ae8870bf5732895c1e68c6f64268a775a617f403 (diff) | |
| download | python-coveragepy-7fd0385cfa5b776b4c7b10c4ff077296db005c49.tar.gz | |
Merge other work
Diffstat (limited to 'tests/plugin2.py')
| -rw-r--r-- | tests/plugin2.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/plugin2.py b/tests/plugin2.py index 9d47d26..658ee22 100644 --- a/tests/plugin2.py +++ b/tests/plugin2.py @@ -1,5 +1,7 @@ """A plugin for test_plugins.py to import.""" +import os.path + import coverage # pylint: disable=missing-docstring @@ -23,16 +25,16 @@ class RenderFileTracer(coverage.plugin.FileTracer): def dynamic_source_filename(self, filename, frame): if frame.f_code.co_name != "render": return None - return frame.f_locals['filename'] + return os.path.abspath(frame.f_locals['filename']) def line_number_range(self, frame): lineno = frame.f_locals['linenum'] - return lineno,lineno+1 + return lineno, lineno+1 class FileReporter(coverage.plugin.FileReporter): def statements(self): # Goofy test arrangement: claim that the file has as many lines as the # number in its name. - num = self.filename.split(".")[0].split("_")[1] + num = os.path.basename(self.filename).split(".")[0].split("_")[1] return set(range(1, int(num)+1)) |
