Open benjamin-kirkbride opened 1 year ago
My opinion is testing the functionality/correctness of should be done against the "library", and testing the CLI should just be to confirm that the flags work as expected.
Basically use the CLI tests for broad, end-to-end type testing, use the lib tests for certifying correctness, edge cases, etc.
I don't have much of a problem with the current situation of duplicate tests, as the existing tests are cheap to leave in place, and easy to remove in the future if nessesary.
As far as YAML vs some other method, the thing I don't love about using YAML is you lose the ablity to do type checking, which is not relevant CLI testing but is more of a problem for library testing.
I don't like how this creates a situation in which tests are duplicated - represented once in the https://github.com/simonw/strip-tags/blob/9a266bf611e34e5c8e3bac44c328205b7eb764a0/tests/test_cli/cases.yaml and then often again in https://github.com/simonw/strip-tags/blob/9a266bf611e34e5c8e3bac44c328205b7eb764a0/tests/test_lib/test_lib.py
I'm open to better ways of reusing the YAML tests to exercise the
strip_tags()
Python function though - this current solution is a bit of an unpleasant hack:https://github.com/simonw/strip-tags/blob/b8ec4c8c002ef227f7af5f77bc0c2ab65ae010d6/tests/test_strip_tags.py#L36-L72