-
Notifications
You must be signed in to change notification settings - Fork 5
Fixes causal test results misalignment when skip:true tests are present #378
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
base: main
Are you sure you want to change the base?
Conversation
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #378 +/- ##
=======================================
Coverage 97.86% 97.87%
=======================================
Files 27 27
Lines 1544 1550 +6
=======================================
+ Hits 1511 1517 +6
Misses 33 33
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
jmafoster1
left a comment
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 solution means that skipped tests don't make it into the results file. Personally, I'd prefer they were still there so we have a record of all the test outcomes so we know if any where skipped (as opposed to not generated/considered). It'd be good to preserve order too if we can, although putting skipped test cases at the end is more acceptable than not having them there at all.
|
Is this what you're after? For example, a causal test case with now has a corresponding result: |
jmafoster1
left a comment
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 is a nice solution. I've suggested a couple of potential minor improvements
| "effect": test_config.get("effect", "direct"), | ||
| "treatment_variable": test_config["treatment_variable"], | ||
| "expected_effect": test_config["expected_effect"], | ||
| "formula": None, |
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.
| "formula": None, | |
| "formula": test_config.get("formula"), |
Just in case the user has specified a formula in the test config.
| | result.effect_estimate.to_dict() | ||
| | (result.adequacy.to_dict() if result.adequacy else {}) | ||
| if result.effect_estimate | ||
| else {"error": result.error_message} |
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.
| else {"error": result.error_message} | |
| else {"status": "error", "reason": result.error_message} |
I quite liked the status/reason format. It might even be nice to include it as part of the "normal" output as well, e.g. "status": "passed/failed". Then we can just query test["result"]["status"]
| ) | ||
|
|
||
| output = { | ||
| "name": test_config["name"], |
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.
Would it be sensible to move the commonalities between the if and the else into a single entry and then update the bits that differ in order to make the code a bit DRY-er? Less to maintain in the future...
In
causal_testing/main.py, thesave_resultsmethod now filters out tests marked with"skip": truein the test configuration, so only active tests are paired with their results and saved.In
tests/main_tests/test_main.py, bothtest_ctfandtest_ctf_exception_silentnow use only active tests (not skipped) when checking which tests passed, aligning the test logic with the updated main code.Closes issue Misaligned test results when skip:true tests are present in causal tests #377