nvim-neotest / neotest-python

MIT License
126 stars 38 forks source link

fix: record skipped and error test results #1

Closed stevearc closed 2 years ago

stevearc commented 2 years ago

Summary

The unittest adapter was reporting skipped and errored tests as succeeded

Not reporting errors was a matter of simply not catching the addError as a distinct state from addFailure

Not reporting skipped tests was because the previous logic set all test results to PASSED and then afterwards merged them with the reported results. The merge logic only updates the status if the new value is "greater than" the old value, but SKIPPED has a lower value than PASSED, so it can never be set.

Given that all tests are going to be run, it doesn't seem necessary to set all the results to PASSED in the beginning, so I've removed that plus the merge logic. If there's a good reason for it to remain, I can rework the PR to fix the merge instead of removing it.

Test Plan

Observe that the skipped test and the error test are properly reported

before: neotest before

after: neotest after

rcarriga commented 2 years ago

LGTM, the unittest part of the code was done once and then unused by me so definitely has some weirdness to it. Thanks for the fix!