Test coverage
- decide a policy for test coverage
- add a CI check that enforces that policy
In cirq, each changed line must have 100% line coverage. I think this is overzealous
- line coverage is a very rough proxy for logical coverage
- mandating test coverage for e.g. input validation code and exception handling perversely incentivizes not writing input validation code
- lines may be covered by other unit tests that incidentally exercise the code in question rather than by an actual, designed unit test
My preference would be for a reviewer-enforced (rather than tooling enforced) policy of at least one unit test per function, method, or data class
My preference would be for a reviewer-enforced (rather than tooling enforced) policy of at least one unit test per function
This is fine for a while but I don't think this should be the long term strategy. Tooling enforced test coverage has proved to be very useful to find bugs in the past and I think it's important to have as the size of the codebase and number of people contributing to it grows over time.
It would be nice to have a few examples of popular scientific python projects' policy and tooling for coverage. I'm pretty ignorant of what is best practice here
Do you want to put in the incremental coverage checks we have in cirq?
No, I think tooling-enforced 100% line coverage requirements has costs and externalities that don't outweigh the benefit