pycytominer
pycytominer copied to clipboard
[Enhancement] Create bug report functionality
in #320, @shntnu introduced a function, which @kenibrewer and I recommended be removed from the PR to be added separately later. This issue documents @shntnu 's progress in this effort:
Would it be possible to move the new
create_bug_report_message
function into a separate branch and pull request to be reviewed separately?
Makes sense, but instead, I'll just copy the code snippet here because I bet you'd want to do this more systematically later
def create_bug_report_message(error_detail, context):
"""
Constructs an error message with a bug report prompt.
Parameters
----------
error_detail: str
Description of the error.
context: str
A description of the context for the error.
Returns
-------
str
Error message with a link to file a bug report.
"""
bug_report_url = "https://github.com/cytomining/pycytominer/issues"
return (
f"{error_detail} This is likely a bug in `{context}`. "
"Please help us improve our software by filing a bug report at "
f"{bug_report_url}."
)
def test_create_bug_report_message():
error_detail = "Division by zero error occurred."
context = "calculate_statistics function"
actual_message = create_bug_report_message(error_detail, context)
# check that the strings `error_detail` and `context` are in the message
assert error_detail in actual_message
assert context in actual_message
# check that the message contains a link to file a bug report
assert "https://github.com/cytomining/pycytominer/issues" in actual_message
Originally posted by @shntnu in https://github.com/cytomining/pycytominer/issues/320#issuecomment-1882081223