-
-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report data file errors in more detail #1782
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
|
||
import coverage | ||
from coverage.data import CoverageData, add_data_to_hash | ||
from coverage.exceptions import NoDataError | ||
from coverage.exceptions import DataFileOrDirectoryNotFoundError | ||
from coverage.files import flat_rootname | ||
from coverage.misc import ( | ||
ensure_dir, file_be_gone, Hasher, isolate_module, format_local_datetime, | ||
|
@@ -317,7 +317,9 @@ def report(self, morfs: Iterable[TMorf] | None) -> float: | |
file_be_gone(os.path.join(self.directory, ftr.html_filename)) | ||
|
||
if not have_data: | ||
raise NoDataError("No data to report.") | ||
raise DataFileOrDirectoryNotFoundError.new( | ||
os.path.dirname(self.coverage.get_data().base_filename()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to think through whether the message here is correct. Is it always that the file doesn't exist? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's good that the exceptions centralize the messages, but everywhere this exception is created it uses the same fairly complex expression. Can we centralize that as well? |
||
) | ||
|
||
self.make_directory() | ||
self.make_local_static_report_files() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to suppress this error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not, but I tried to limit how many outputs I changed. Would you like this to display a friendly error instead?