Skip to content

Commit

Permalink
Ensure backend info is available in exception
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Feb 22, 2023
1 parent 2219922 commit b22169e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pyproject_hooks/_in_process/_in_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _build_backend():
try:
obj = import_module(mod_path)
except ImportError:
msg = "Cannot import {mod_path!r}"
msg = f"Cannot import {mod_path!r}"
raise BackendUnavailable(msg, traceback.format_exc())

if obj_path:
Expand Down
4 changes: 3 additions & 1 deletion tests/test_call_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ def get_hooks(pkg, **kwargs):
def test_missing_backend_gives_exception():
hooks = get_hooks("pkg1")
with modified_env({"PYTHONPATH": ""}):
with pytest.raises(BackendUnavailable):
msg = "Cannot import 'buildsys'"
with pytest.raises(BackendUnavailable, match=msg) as exc:
hooks.get_requires_for_build_wheel({})
assert exc.value.backend_name == "buildsys"


def test_get_requires_for_build_wheel():
Expand Down

0 comments on commit b22169e

Please sign in to comment.