File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 7
7
8
8
9
9
@asyncio .coroutine
10
- def async_coro (loop ):
10
+ def async_coro (loop = None ):
11
11
"""A very simple coroutine."""
12
12
yield from asyncio .sleep (0 , loop = loop )
13
13
return 'ok'
@@ -143,3 +143,18 @@ def test_asyncio_marker_method(self, event_loop):
143
143
"""Test the asyncio pytest marker in a Test class."""
144
144
ret = yield from async_coro (event_loop )
145
145
assert ret == 'ok'
146
+
147
+
148
+ class TestUnexistingLoop :
149
+ @pytest .fixture
150
+ def remove_loop (self ):
151
+ old_loop = asyncio .get_event_loop ()
152
+ asyncio .set_event_loop (None )
153
+ yield
154
+ asyncio .set_event_loop (old_loop )
155
+
156
+ @pytest .mark .asyncio
157
+ def test_asyncio_marker_without_loop (self , remove_loop ):
158
+ """Test the asyncio pytest marker in a Test class."""
159
+ ret = yield from async_coro ()
160
+ assert ret == 'ok'
You can’t perform that action at this time.
0 commit comments