-
Couldn't load subscription status.
- Fork 2.6k
Fix async client safety #3512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix async client safety #3512
Changes from 3 commits
c87e01f
95693c8
3953ac3
34ce3de
955df70
1580dd4
cf079d1
a12aff3
2c9af66
fa43e6b
31e6a44
91575b7
e14ec3d
0aafcfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,12 @@ def linters(c): | |
| run("vulture redis whitelist.py --min-confidence 80") | ||
| run("flynt --fail-on-change --dry-run tests redis") | ||
|
|
||
| @task | ||
|
||
| def formatters(c): | ||
| """Format code""" | ||
| run("black --target-version py37 tests redis") | ||
| run("isort tests redis") | ||
|
|
||
|
|
||
| @task | ||
| def all_tests(c): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import asyncio | ||
|
|
||
| import pytest | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_usage_counter(create_redis): | ||
| r = await create_redis(decode_responses=True) | ||
|
|
||
| async def dummy_task(): | ||
| async with r: | ||
| await asyncio.sleep(0.01) | ||
|
|
||
| tasks = [dummy_task() for _ in range(20)] | ||
| await asyncio.gather(*tasks) | ||
|
|
||
| # After all tasks have completed, the usage counter should be back to zero. | ||
| assert r._usage_counter == 0 |
Uh oh!
There was an error while loading. Please reload this page.