async-timer 1.1.3__tar.gz → 1.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: async-timer
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: The missing Python async timer.
5
5
  License: MIT
6
6
  Keywords: async,timer
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "async-timer"
3
- version = "v1.1.3"
3
+ version = "v1.1.4"
4
4
  description = "The missing Python async timer."
5
5
  authors = ["Ilya O. <vrghost@gmail.com>"]
6
6
  license = "MIT"
@@ -1,3 +1,4 @@
1
+ import asyncio
1
2
  import unittest.mock
2
3
 
3
4
  import async_timer
@@ -13,8 +14,16 @@ class MockPacemaker(async_timer.pacemaker.TimerPacemaker):
13
14
  async def _try_wait(self, delay: float):
14
15
  if self._cancel_evt.is_set():
15
16
  raise StopAsyncIteration()
17
+
18
+ await self._sleep_until_next_loop_iter()
16
19
  await self.sleep(delay)
17
20
 
21
+ async def _sleep_until_next_loop_iter(self):
22
+ """Awaiting this function will release on the next async loop iteration"""
23
+ fut = asyncio.Future()
24
+ asyncio.get_event_loop().call_soon(lambda: fut.set_result(42))
25
+ await fut
26
+
18
27
 
19
28
  class MockTimer(async_timer.Timer):
20
29
  """Test-friendly mock timer class.
File without changes