Skip to content

Commit 86403f0

Browse files
committed
RuntimeError -> AsyncGeneratorFixtureDidNotStopError
1 parent 64d7498 commit 86403f0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pytest_twisted.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ def from_mark(cls, mark):
2222
)
2323

2424

25+
class AsyncGeneratorFixtureDidNotStopError(Exception):
26+
@classmethod
27+
def from_generator(cls, generator):
28+
return cls(
29+
'async fixture did not stop: {}'.format(generator),
30+
)
31+
32+
2533
class _config:
2634
external_reactor = False
2735

@@ -172,8 +180,8 @@ def _pytest_pyfunc_call(pyfuncitem):
172180
except StopAsyncIteration:
173181
continue
174182
else:
175-
raise RuntimeError(
176-
'async fixture did not stop: {}'.format(arg),
183+
raise AsyncGeneratorFixtureDidNotStopError.from_generator(
184+
generator=arg,
177185
)
178186

179187
defer.returnValue(result)

0 commit comments

Comments
 (0)