-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix `AsyncEmitSource` By replacing the queue timeout implementation. [ML-4421](https://jira.iguazeng.com/browse/ML-4421) * Delete print
- Loading branch information
Showing
4 changed files
with
89 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import asyncio | ||
|
||
import pytest | ||
|
||
from storey.queue import SimpleAsyncQueue | ||
|
||
|
||
async def async_test_simple_async_queue(): | ||
q = SimpleAsyncQueue(2) | ||
|
||
with pytest.raises(TimeoutError): | ||
await q.get(0) | ||
|
||
get_task = asyncio.create_task(q.get(1)) | ||
await q.put("x") | ||
assert await get_task == "x" | ||
|
||
await q.put("x") | ||
await q.put("y") | ||
put_task = asyncio.create_task(q.put("z")) | ||
assert await q.get() == "x" | ||
await put_task | ||
assert await q.get() == "y" | ||
assert await q.get() == "z" | ||
|
||
|
||
def test_simple_async_queue(): | ||
asyncio.run(async_test_simple_async_queue()) |