Skip to content

Improve validation errors and log test duration#996

Open
MaximIgitov wants to merge 1 commit intotaverntesting:masterfrom
MaximIgitov:better-errors-and-duration-metric
Open

Improve validation errors and log test duration#996
MaximIgitov wants to merge 1 commit intotaverntesting:masterfrom
MaximIgitov:better-errors-and-duration-metric

Conversation

@MaximIgitov
Copy link
Copy Markdown

Summary

  • include stage name and missing key path in schema validation errors
  • log per-test duration in a parseable format
  • add unit tests for both behaviors

Test plan

  • not run (Python tooling not installed on server)

Comment on lines +301 to +306
duration = time.perf_counter() - start_time
logger.info(
"tavern.test_duration_seconds=%0.3f test=%s",
duration,
self.name,
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this timing? This can already be done with a fixture like in the docs: https://tavern.readthedocs.io/en/latest/basics.html#usefixtures

real_context.append(
f"""
{c.message}
{_format_validation_message(c)}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely is something that is currently a bit messy and could be improved, could you add a docstring to the above functions or just an example of before/after to compare what's changed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants