Skip to content

Commit f338c59

Browse files
committed
Improve too-many-Clocks message
1 parent 222f6ff commit f338c59

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pytest_trio/plugin.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,13 @@ def decorator(fn):
343343
@wraps(fn)
344344
def wrapper(**kwargs):
345345
__tracebackhide__ = True
346-
clocks = [c for c in kwargs.values() if isinstance(c, Clock)]
346+
clocks = {k: c for k, c in kwargs.items() if isinstance(c, Clock)}
347347
if not clocks:
348348
clock = None
349349
elif len(clocks) == 1:
350-
clock = clocks[0]
350+
clock = list(clocks.values())[0]
351351
else:
352-
raise ValueError("too many clocks spoil the broth!")
352+
raise ValueError(f"Expected at most one Clock in kwargs, got {clocks!r}")
353353
instruments = [
354354
i for i in kwargs.values() if isinstance(i, Instrument)
355355
]

0 commit comments

Comments
 (0)