Skip to content

Better error message for unknown device#2343

Merged
brownbaerchen merged 3 commits into
helmholtz-analytics:mainfrom
brownbaerchen:device_error_message
Jun 10, 2026
Merged

Better error message for unknown device#2343
brownbaerchen merged 3 commits into
helmholtz-analytics:mainfrom
brownbaerchen:device_error_message

Conversation

@brownbaerchen

Copy link
Copy Markdown
Collaborator

This PR includes the requested device in the error message when said device is not found.
It also includes a test for this. Note the handy match argument of pytest.raises that makes such tests convenient.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to make sanitize_device()/use_device() errors more informative by including the originally requested device identifier in the “unknown device” ValueError, and adds a regression test to assert that behavior.

Changes:

  • Update the “unknown device” ValueError message in heat/core/devices.py to include the requested device.
  • Add a new test asserting the requested device string appears in the error message.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/core/test_devices.py Adds a regression test checking the unknown-device error message includes the requested device.
heat/core/devices.py Updates the ValueError message raised for unknown device identifiers to include the requested device.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread heat/core/devices.py
mtar
mtar previously approved these changes Jun 10, 2026

@mtar mtar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One small suggestion to make the available options clearer.

Comment thread heat/core/devices.py Outdated
@github-project-automation github-project-automation Bot moved this from Todo to Merge queue in Roadmap Jun 10, 2026
Co-authored-by: Michael Tarnawa <18899420+mtar@users.noreply.github.com>
@brownbaerchen brownbaerchen requested a review from mtar June 10, 2026 07:35
@brownbaerchen brownbaerchen merged commit 451b3af into helmholtz-analytics:main Jun 10, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Merge queue to Done in Roadmap Jun 10, 2026
@brownbaerchen brownbaerchen deleted the device_error_message branch June 10, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants