willkg / markus

Markus is a Python library for generating metrics
Mozilla Public License 2.0
70 stars 8 forks source link

Print markus records on assertion failure #74

Closed jwhitlock closed 3 years ago

jwhitlock commented 4 years ago

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.