Skip to content
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

Feature deterministic results parser #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions flapy/results_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,14 @@ def to_tests_overview(self) -> pd.DataFrame:
test_overview["Test_nodeid_inclPara"] = (
test_overview["Test_nodeid"] + test_overview["Test_parametrization"]
)

# Sort to ensure deterministic behaviour. Needs to use tuple in order to sort
test_overview["Verdicts_sameOrder"] = test_overview["Verdicts_sameOrder"].apply(tuple)
test_overview["Verdicts_randomOrder"] = test_overview["Verdicts_randomOrder"].apply(tuple)
test_overview.sort_values(["Verdicts_sameOrder", "Verdicts_randomOrder"], ascending=[True, True], inplace=True, key=tuple)
test_overview["Verdicts_sameOrder"] = test_overview["Verdicts_sameOrder"].apply(set)
test_overview["Verdicts_randomOrder"] = test_overview["Verdicts_randomOrder"].apply(set)

return test_overview

def __repr__(self):
Expand Down Expand Up @@ -385,6 +393,8 @@ def to_classification_template(self) -> pd.DataFrame:
classification_template["Category"] = ""
classification_template["Category sure? 1=yes 4=no"] = ""
classification_template["Category comment"] = ""

classification_template.sort_values(["Project_Name", "Project_URL", "Project_Hash", "Test_name"], ascending=[True, True, True, True], inplace=True)
return classification_template

def to_flapy_input(
Expand Down Expand Up @@ -965,6 +975,9 @@ def get_passed_failed(

passed_failed.insert(1, "Iteration_status", "ok")

# Sort to ensure deterministic behaviour
passed_failed.sort_values(["Passed_sameOrder", "Failed_sameOrder"], ascending=[True, True], inplace=True)

return passed_failed[
[
"Iteration",
Expand Down