diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-02-12 14:01:42 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-12 14:01:42 -0800 |
commit | 7c023d24b3fb3f0610e960d7d177ec0694bd4004 (patch) | |
tree | 09cab955bc3c5bacf16196ebfa28ffd67ce2e55b | |
parent | 07e1c4b65d7f08486e7c7f39638abfedeccd6f39 (diff) | |
download | redis-py-7c023d24b3fb3f0610e960d7d177ec0694bd4004.tar.gz |
Enable warnings during tests and fix discovered cases (#1283)
Helps identify problematic or buggy code. When a warning is displayed,
it should be analyzed and fixed.
The r and r2 fixture now close the client after the test is complete.
-rw-r--r-- | tests/conftest.py | 6 | ||||
-rw-r--r-- | tox.ini | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 87e6301..0007b84 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -74,13 +74,15 @@ def _get_client(cls, request, single_connection_client=True, **kwargs): @pytest.fixture() def r(request): - return _get_client(redis.Redis, request) + with _get_client(redis.Redis, request) as client: + yield client @pytest.fixture() def r2(request): "A second client for tests that need multiple" - return _get_client(redis.Redis, request) + with _get_client(redis.Redis, request) as client: + yield client def _gen_cluster_mock_resp(r, response): @@ -9,7 +9,7 @@ deps = pytest >= 2.7.0 extras = hiredis: hiredis -commands = {envpython} -m coverage run -m pytest {posargs} +commands = {envpython} -m coverage run -m pytest -W always {posargs} [testenv:pycodestyle] basepython = python3.6 |