Add infra pytest warnings plugin#2757
Add infra pytest warnings plugin#2757vchamarthi wants to merge 2 commits intoIntelPython:dev-milestonefrom
Conversation
|
|
||
| if self._events_fp is not None: | ||
| try: | ||
| self._events_fp.write(_json_dumps_one_line(event) + "\n") |
There was a problem hiding this comment.
Would it be better to dump all events at once in pytest_terminal_summary to reduce pressure on the file system?
There was a problem hiding this comment.
This particular line is writing the warnings to the artifact (events.jsonl) file whenever there is a warning.
The summary (summarized based of event.jsonl) will be all dumped at once to terminal and summary.json file at the end.
Summary written to terminal here - https://github.com/IntelPython/dpnp/pull/2757/changes#diff-e9924e662a511d3ac4d9aa5d26f9e9ac8865aad6a67b1dedbd9e24ce0079e590R213
Summary written to artifact here - https://github.com/IntelPython/dpnp/pull/2757/changes#diff-e9924e662a511d3ac4d9aa5d26f9e9ac8865aad6a67b1dedbd9e24ce0079e590R201
There was a problem hiding this comment.
This particular line is writing the warnings to the artifact (events.jsonl) file whenever there is a warning.
But we can do that 2 different ways:
- Write each warning to
events.jsonlfile oncepytest_warning_recordedcalled (current approach as I can see) - Add each warning reported by
pytest_warning_recordedcallback to a list (or whatever collection used) and write all of them at once insidepytest_terminal_summarycallback
There was a problem hiding this comment.
This is already implemented. There are two different things written to terminal
- Actual warning{s) and
- The summary of all warnings.
The warnings are written to terminal in the same callback pytest_warning_recorded here - https://github.com/IntelPython/dpnp/pull/2757/changes#diff-e9924e662a511d3ac4d9aa5d26f9e9ac8865aad6a67b1dedbd9e24ce0079e590R174
In the pytest_terminal_summary callback only the summary of the total warnings is prepared and written to terminal at the end of the tests.
This PR introduce the plugin feature to capture and format pytest warnings to process it in internal CI.
These changes will not add any overhead to existing pytest scope. This feature can be fully enabled/disabled by env var -
DPNP_INFRA_WARNINGS_ENABLE