When using MetricsMock's test helpers, I always want to see the records on test failures. This can be done manually, such as running pytest --pdb and inspecting, or changing the test to include metricsmock.print_records().
pytest has a type-based method for adding more data to assetions, but this may require some gymnastics to wrap results in a new type, solely for the purpose of better failed test output.
Another option is to manually create the failure message to include the records. This would lose pytest assertion output but would work for other test frameworks.
When using
MetricsMock
's test helpers, I always want to see the records on test failures. This can be done manually, such as runningpytest --pdb
and inspecting, or changing the test to includemetricsmock.print_records()
.pytest has a type-based method for adding more data to assetions, but this may require some gymnastics to wrap results in a new type, solely for the purpose of better failed test output.
Another option is to manually create the failure message to include the records. This would lose pytest assertion output but would work for other test frameworks.