summaryrefslogtreecommitdiff
path: root/tests/test_asyncio/test_cluster.py
diff options
context:
space:
mode:
authorKristján Valur Jónsson <sweskman@gmail.com>2022-07-26 12:25:23 +0000
committerGitHub <noreply@github.com>2022-07-26 15:25:23 +0300
commit6f208212ed9114921840404591aecca9acd38f08 (patch)
treeab37049c4d6b5c04a11b32c85218d50bd8d54d52 /tests/test_asyncio/test_cluster.py
parent1df1d32bb6845d2ccbbc340199babe9fe0ef29d6 (diff)
downloadredis-py-6f208212ed9114921840404591aecca9acd38f08.tar.gz
Fix warnings and resource usage problems in asyncio unittests (#2258)
* Use pytest-asyncio in auto mode Remove overly genereric `pytestmark=pytest.mark.asyncio` causing lots of warning noise * Use "Factories as Fixtures" test pattern for the `create_redis` fixture this fixture is now async, avoiding teardown problems with missing event loops. * Fix sporadic error on fast event loops, such as `--uvloop` * Close connection, even if "username" was in kwargs This fixes a resource usage warning in the async unittests. * Do async cleanup of acl passwords via a fixture * Remove unused import, fix whitespace * Fix test with missing "await" * Close pubsub objects after use in unittest Use a simple fixture where possible, otherwise manually call pubsub.close() * re-introduce `pytestmark=pytest.mark.asyncio` for python 3.6 * Use context manager to clean up connections in connection pool for unit tests * Provide asynccontextmanager for python 3.6 * make `test_late_subscribe()` more robuste * Catch a couple of additional leaked resources
Diffstat (limited to 'tests/test_asyncio/test_cluster.py')
-rw-r--r--tests/test_asyncio/test_cluster.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_asyncio/test_cluster.py b/tests/test_asyncio/test_cluster.py
index 0d0ea33..8766cbf 100644
--- a/tests/test_asyncio/test_cluster.py
+++ b/tests/test_asyncio/test_cluster.py
@@ -11,6 +11,8 @@ from .compat import mock
if sys.version_info[0:2] == (3, 6):
import pytest as pytest_asyncio
+
+ pytestmark = pytest.mark.asyncio
else:
import pytest_asyncio
@@ -39,8 +41,6 @@ from tests.conftest import (
skip_unless_arch_bits,
)
-pytestmark = pytest.mark.asyncio
-
default_host = "127.0.0.1"
default_port = 7000
default_cluster_slots = [