Closed
Description
A couple years ago I wanted to add CLI tests.
@acdha is it okay if I add tests to cover the CLI? It would have caught the bug I fixed in 61769cd, but I hadn't seen an approach to testing in the package yet.
Definitely – that's a big gap in the test coverage currently
Originally posted by @acdha in #138 (comment)
I've since tried a couple strategies on other projects, none of which are clearly preferably. The two strategies I'm consider are:
- Unit test
_make_parser()
which is relatively straightforward but leavesmain()
untested, where bugs are more likely to occur. - Function test
main()
which is more complete but repeats many of the existing tests, just with an additional abstraction layer.
My preference would be to test main()
against the following cases.
- Not enough processes
- Invalid use of
--fast
- Invalid use of
--completeness-only
- Successful validate
--fast
- Successful validate
--completeness-only
- Successful validate
- Unsuccessful validate
--fast
- Unsuccessful validate
--completeness-only
- Unsuccessful validate
- Successful bag creation
- Unsuccessful bag creation
Does that sound like a good strategy? I'm happy to go in another direction.
Metadata
Metadata
Assignees
Labels
No labels