-
Notifications
You must be signed in to change notification settings - Fork 5
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
Update pytest xml parser and markdown gist results #45
Conversation
cd93b12
to
87c22db
Compare
87c22db
to
76b6669
Compare
if test_function_module != "": | ||
if test_name_function != "": | ||
if test_function_module in test_links: | ||
test_permalink = test_links[test_function_module] + "#" + test_function_module + "." + test_name_function | ||
test_name_link = f"[{test_name}]({test_permalink})" | ||
else: | ||
if test_function_module in test_links: |
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.
Checking if test_function_module is in test_links can be joined with the first check if the test_function_module != "".
# Convert remaining string to a dictionary | ||
param_dict = ast.literal_eval(new_param) | ||
if param_dict: | ||
for key, value in param_dict.items(): | ||
# Convert parameters back to string | ||
new_updated = "'" + key + "'" + ": " + str(value) | ||
param_list.append(new_updated) | ||
insert_param_name = param_name + "=" | ||
param_list.insert(0, insert_param_name) | ||
param_list_string = " \n".join(param_list) |
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.
Will .replace(", '", ",\n'") not work for this?
if len(prop_list) > 1: | ||
for props in prop_list: | ||
if len(props) > 0: | ||
# Remove leading spaces | ||
prop_strip = props.lstrip() | ||
prop_list_updated.append(prop_strip) | ||
if len(prop_list_updated) > 0: | ||
new_props = " ".join(prop_list_updated) | ||
# Combine exception type, message, and parameters | ||
exctype_message = "\n" + " " + new_props + " ( " + exc_param_value + " )" |
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.
What's an example of a property value that satisfies this condition and requires such parsing?
pytest_failures_details = "No failures" | ||
pytest_failures_details = "Invalid" if pytest_tests_status == "⛔" else pytest_failures_details |
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.
Combine "No failures" after else instead
@@ -243,13 +245,153 @@ def get_payload_parsed(self): | |||
payload_param = param | |||
return (payload, payload_param) | |||
|
|||
class PytestFailure(xmlParser): |
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.
Good use of inheritance for maintaining code structure and reusability
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 can be merged now. Mods can be done later.
This change adds a separate class for parsing pytest results xml Signed-off-by: Trisha De Vera <Trisha.Devera@analog.com>
This change updates the stucture of pytest results to gistfor markdown template Signed-off-by: Trisha De Vera <Trisha.Devera@analog.com>
Signed-off-by: Trisha De Vera <Trisha.Devera@analog.com>
Signed-off-by: Trisha De Vera <Trisha.Devera@analog.com>
Signed-off-by: Trisha De Vera <Trisha.Devera@analog.com>
Signed-off-by: Trisha De Vera <Trisha.Devera@analog.com>
This change includes adding a class for parsing pytest xml, updating test artifacts, and adding a pytest_failure parameter for parser test. The parser class adds test details in gist results such as parameters used for the test, error message, and inline link for test description.