I not only want to write unit tests in my Foundry Code Repository, but I want to enforce a minimum amount of coverage for checks to pass.
It's a best practice to ensure that I'm covering at least a certain fraction of my code with unit tests, but tests don't seem to be a requirement in standard repositories.
How do I accomplish my two testing goals within my Foundry Code Repository?
You can use PyTest Coverage to compute coverage and enforce a minimum percentage.
meta.yml
:Note: this is outside the requirements section in a section of its own.
pytest.ini
file at/transforms-python/src/pytest.ini
with the following contents:Note: you can tune the enforcement percentage down from 100 if you'd like
Your tests will now fail, even if they include some unit tests, if that coverage threshold is below your configured value: