Skip to content

Commit aac5934

Browse files
committed
review fixes
1 parent c501a32 commit aac5934

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/pluggy/_hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def set_specification(
338338
spec_opts: "_HookSpecOpts",
339339
) -> None:
340340
if self.spec is not None:
341-
raise RuntimeError(
341+
raise ValueError(
342342
f"Hook {self.spec.name!r} is already registered "
343343
f"within namespace {self.spec.namespace}"
344344
)

testing/test_hookcaller.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,5 +419,9 @@ def conflict(self) -> None:
419419
pass
420420

421421
pm.add_hookspecs(Api1)
422-
with pytest.raises(RuntimeError):
422+
with pytest.raises(ValueError) as exc:
423423
pm.add_hookspecs(Api2)
424+
assert str(exc.value) == (
425+
"Hook 'conflict' is already registered within namespace "
426+
"<class 'test_hookcaller.test_hook_conflict.<locals>.Api1'>"
427+
)

0 commit comments

Comments
 (0)