diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-06-15 15:32:43 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-06-15 15:32:43 -0400 |
commit | 730ef8b6047bcbe8b92675b5a8bcbe1060585d16 (patch) | |
tree | f499f824574ca3afa23f231ccb5534eeea23f52e /coverage/annotate.py | |
parent | cb1b65a4ad1b8302304706b1775401d165486d02 (diff) | |
download | python-coveragepy-git-730ef8b6047bcbe8b92675b5a8bcbe1060585d16.tar.gz |
Reporter base class shouldn't be responsible for directories
Diffstat (limited to 'coverage/annotate.py')
-rw-r--r-- | coverage/annotate.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/coverage/annotate.py b/coverage/annotate.py index 1d228004..3380dccc 100644 --- a/coverage/annotate.py +++ b/coverage/annotate.py @@ -8,7 +8,7 @@ import os import re from coverage.files import flat_rootname -from coverage.misc import isolate_module +from coverage.misc import ensure_dir, isolate_module from coverage.report import Reporter os = isolate_module(os) @@ -49,8 +49,9 @@ class AnnotateReporter(Reporter): See `coverage.report()` for arguments. """ + self.directory = directory self.coverage.get_data() - self.report_files(self.annotate_file, morfs, directory) + self.report_files(self.annotate_file, morfs) def annotate_file(self, fr, analysis): """Annotate a single file. @@ -63,6 +64,7 @@ class AnnotateReporter(Reporter): excluded = sorted(analysis.excluded) if self.directory: + ensure_dir(self.directory) dest_file = os.path.join(self.directory, flat_rootname(fr.relative_filename())) if dest_file.endswith("_py"): dest_file = dest_file[:-3] + ".py" |