Skip to content

Add infra pytest warnings plugin#2757

Open
vchamarthi wants to merge 2 commits intoIntelPython:dev-milestonefrom
vchamarthi:dpnp-warnings-plugin
Open

Add infra pytest warnings plugin#2757
vchamarthi wants to merge 2 commits intoIntelPython:dev-milestonefrom
vchamarthi:dpnp-warnings-plugin

Conversation

@vchamarthi
Copy link

@vchamarthi vchamarthi commented Feb 5, 2026

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

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?


if self._events_fp is not None:
try:
self._events_fp.write(_json_dumps_one_line(event) + "\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better to dump all events at once in pytest_terminal_summary to reduce pressure on the file system?

Copy link
Author

Choose a reason for hiding this comment

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

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

Copy link
Contributor

Choose a reason for hiding this comment

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

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:

  1. Write each warning to events.jsonl file once pytest_warning_recorded called (current approach as I can see)
  2. Add each warning reported by pytest_warning_recorded callback to a list (or whatever collection used) and write all of them at once inside pytest_terminal_summary callback

Copy link
Author

Choose a reason for hiding this comment

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

This is already implemented. There are two different things written to terminal

  1. Actual warning{s) and
  2. 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.

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