-
Notifications
You must be signed in to change notification settings - Fork 34
fix(anta): Fix various issues in CSV and Markdown reporters #990
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
Conversation
CodSpeed Performance ReportMerging #990 will improve performances by 14.24%Comparing Summary
Benchmarks breakdown
|
anta/reporter/csv_reporter.py
Outdated
@@ -111,6 +111,7 @@ def generate(cls, results: ResultManager, csv_filename: pathlib.Path) -> None: | |||
csvwriter = csv.writer( | |||
csvfile, | |||
delimiter=",", | |||
lineterminator="\n", |
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.
hmmm are you sure this works on windows?
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.
Ah yes probably not :P I was just trying to make Ansible sanity (or lint?) happy in the PyAVD PR. I will add a flag to the function signature.
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.
Fixed in 50da83a
# Test multiple sort fields | ||
sorted_manager = result_manager.sort(["result", "test"]) | ||
results = sorted_manager.results | ||
assert results[0].result == "error" | ||
assert results[0].test == "Test3" | ||
assert results[1].result == "failure" | ||
assert results[1].test == "Test2" | ||
assert results[2].result == "success" | ||
assert results[2].test == "Test1" |
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.
this does not really test the sorting on the second field - would need an extra test with same result field to check
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.
Fixed in 50da83a. Thanks
# Test invalid sort field | ||
with pytest.raises( | ||
ValueError, | ||
match=re.escape( | ||
"Invalid sort_by fields: ['bad_field']. Accepted fields are: ['name', 'test', 'categories', 'description', 'result', 'messages', 'custom_field']", | ||
), | ||
): | ||
result_manager.sort(["bad_field"]) | ||
|
||
# Verify the method is chainable | ||
assert isinstance(result_manager.sort(["name"]), ResultManager) |
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.
I feel like it would be easier to maintain with more granular tests rather than one big (I know it means more lines :) ) as here if the test fail we need to fo through the full test to understand whats going on
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.
Fixed in 50da83a
|
Description
ResultManager.sort
ResultManager
stats properties by defaultChecklist:
pre-commit run
)tox -e testenv
)