Skip to content

Propagate timestamps from CallInfo to TestReport objects #10711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 10, 2023

Conversation

HTRafal
Copy link
Contributor

@HTRafal HTRafal commented Feb 6, 2023

TestReport objects stored only the information about stage duration. This is not enough to correlate pytest stages with external events. Timestamps are already there in CallInfo. They just needed to be propagated to TestReport objects, so that they can be read when TestReports are exported externally (for example with --reportlog option)

Closes #10710

TestReport objects stored only the information about stage duration.
This is not enough to correlate pytest stages with external events.
Timestamps are already there in CallInfo. They just needed to be
propagated to TestReport objects, so that they can be read when
TestReports are exported externally (for example with --reportlog
option)
Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

Just for the sake of it we should add some unittest for the feature

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

As @RonnyPfannschmidt mentions, we need a unittest for the feature, ideally we also need to ensure that the serialization/unserialization will work for those new attributes if we want to make sure it will also work out of the box with pytest-reportlog.

Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
@HTRafal HTRafal force-pushed the timestamps branch 3 times, most recently from 38dfbdd to 2808854 Compare February 9, 2023 12:47
@HTRafal HTRafal requested a review from nicoddemus February 9, 2023 12:58
Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

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

Looks good, wondering if we have a way to make a unittest for this

@HTRafal
Copy link
Contributor Author

HTRafal commented Feb 10, 2023

@RonnyPfannschmidt what do you mean? I added a unit test in testing/test_reports.py that tests serialization of the new fields. That should be enough for pytest-reportlog to work as it only calls pytest_report_to_serializable and saves the result to a json file.

@RonnyPfannschmidt
Copy link
Member

The test is indeed enough, it however involves quite some machinery that we currently have no nicely testable way to leave out

@RonnyPfannschmidt
Copy link
Member

Aka there should be one test that just verifies the transfer from callinfo to report and a second test that only verifies the serialization

But we lack the infrastructure for those pinpointed tests, so we can't exactly ask for their addition in good conscience

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

Thanks, looks great!

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.

Include timestamps in reportlog
3 participants