-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Conversation
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)
There was a problem hiding this 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
There was a problem hiding this 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>
38dfbdd
to
2808854
Compare
There was a problem hiding this 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
@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. |
The test is indeed enough, it however involves quite some machinery that we currently have no nicely testable way to leave out |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great!
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