fakeredis icon indicating copy to clipboard operation
fakeredis copied to clipboard

1.7.1: pytest warnings

Open kloczek opened this issue 2 years ago • 5 comments

pytest summary warnings

============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191
  /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191: DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
    config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)

../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:226
  /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:226: DeprecationWarning: '@pytest.fixture' is applied to <fixture conn, file=/home/tkloczko/rpmbuild/BUILD/fakeredis-1.7.1/test/test_aioredis1.py, line=39> in 'legacy' mode, please replace it with '@pytest_asyncio.fixture' as a preparation for switching to 'strict' mode (or use 'auto' mode to seamlessly handle all these fixtures as asyncio-driven).
    warnings.warn(

../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:226
  /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:226: DeprecationWarning: '@pytest.fixture' is applied to <fixture r, file=/home/tkloczko/rpmbuild/BUILD/fakeredis-1.7.1/test/test_aioredis1.py, line=17> in 'legacy' mode, please replace it with '@pytest_asyncio.fixture' as a preparation for switching to 'strict' mode (or use 'auto' mode to seamlessly handle all these fixtures as asyncio-driven).
    warnings.warn(

../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:226
  /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:226: DeprecationWarning: '@pytest.fixture' is applied to <fixture conn, file=/home/tkloczko/rpmbuild/BUILD/fakeredis-1.7.1/test/test_aioredis2.py, line=49> in 'legacy' mode, please replace it with '@pytest_asyncio.fixture' as a preparation for switching to 'strict' mode (or use 'auto' mode to seamlessly handle all these fixtures as asyncio-driven).
    warnings.warn(

../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:226
  /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:226: DeprecationWarning: '@pytest.fixture' is applied to <fixture r, file=/home/tkloczko/rpmbuild/BUILD/fakeredis-1.7.1/test/test_aioredis2.py, line=24> in 'legacy' mode, please replace it with '@pytest_asyncio.fixture' as a preparation for switching to 'strict' mode (or use 'auto' mode to seamlessly handle all these fixtures as asyncio-driven).
    warnings.warn(

test/test_aioredis2.py::test_blocking_timeout[fake]
test/test_aioredis2.py::test_blocking_unblock[fake]
  /home/tkloczko/rpmbuild/BUILDROOT/python-fakeredis-1.7.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/fakeredis/_async.py:19: DeprecationWarning: with timeout() is deprecated, use async with timeout() instead
    with async_timeout.timeout(timeout if timeout else None):

test/test_aioredis2.py::test_repr[fake]
  test/test_aioredis2.py:197: PytestWarning: The test <Function test_repr[fake]> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    @fake_only

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================

kloczek avatar Apr 18 '22 09:04 kloczek

Warnings are fixed in the new version: https://github.com/dsoftwareinc/fakeredis-py/runs/6627979677?check_suite_focus=true

cunla avatar Jun 04 '22 12:06 cunla

Retested 1.8 and still I see warnings

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-fakeredis-1.8-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-fakeredis-1.8-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/fakeredis-py-1.8, configfile: pyproject.toml
plugins: cov-3.0.0, asyncio-0.18.2, mock-3.7.0, hypothesis-6.41.0
asyncio: mode=strict
collected 1303 items

test/test_aioredis1.py ssssssssssssssssssssssssss                                                                                                                    [  1%]
test/test_aioredis2.py ..s.s.s.s.s.s.s.s.s.s.s.s.s.s.......                                                                                                          [  4%]
test/test_fakeredis.py s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s [ 15%]
.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s [ 28%]
.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s [ 40%]
.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.ssssss......sss...ssssss......ss..ss..s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s [ 53%]
.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s [ 65%]
.s.s.s..s.s.s.s.s.s.s.s.s.s.s.s.ss..s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.ss..s.s...s.s.s.s.s................................. [ 78%]
...................................................................s                                                                                                 [ 83%]
test/test_hypothesis.py sssssssssss                                                                                                                                  [ 84%]
test/test_init_args.py ..........                                                                                                                                    [ 85%]
test/test_lua.py s.s.s.s.s.s.s.s.s.s.sss.s.s.sss.s.s.s.s.s.s.s.s.s.s.s.s.sss.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s.s..s..s..                                                 [ 92%]
test/test_redis2_only.py ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss                                                              [ 98%]
test/test_redis4_plus.py ss.s.s.s.s.s..                                                                                                                              [100%]

============================================================================= warnings summary =============================================================================
test/test_aioredis2.py::test_redis_asyncio_is_used
  test/test_aioredis2.py:59: PytestWarning: The test <Function test_redis_asyncio_is_used> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    @testtools.run_test_if_redis_ver('above', '4.2')

test/test_fakeredis.py::test_hmset_empty_raises_error[FakeStrictRedis]
  /home/tkloczko/rpmbuild/BUILD/fakeredis-py-1.8/test/test_fakeredis.py:1558: DeprecationWarning: FakeStrictRedis.hmset() is deprecated. Use FakeStrictRedis.hset() instead.
    r.hmset('foo', {})

test/test_fakeredis.py::test_hmset[FakeStrictRedis]
  /home/tkloczko/rpmbuild/BUILD/fakeredis-py-1.8/test/test_fakeredis.py:1563: DeprecationWarning: FakeStrictRedis.hmset() is deprecated. Use FakeStrictRedis.hset() instead.
    assert r.hmset('foo', {'k2': 'v2', 'k3': 'v3'}) is True

test/test_fakeredis.py::test_hmset_wrong_type[FakeStrictRedis]
  /home/tkloczko/rpmbuild/BUILD/fakeredis-py-1.8/test/test_fakeredis.py:1569: DeprecationWarning: FakeStrictRedis.hmset() is deprecated. Use FakeStrictRedis.hset() instead.
    r.hmset('foo', {'key': 'value'})

test/test_fakeredis.py::TestFakeStrictRedisConnectionErrors::test_hmset[FakeStrictRedis]
  /home/tkloczko/rpmbuild/BUILD/fakeredis-py-1.8/test/test_fakeredis.py:4447: DeprecationWarning: FakeStrictRedis.hmset() is deprecated. Use FakeStrictRedis.hset() instead.
    r.hmset('name', {'key': 1})

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [2] test/test_aioredis1.py:49: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:54: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:64: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:75: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:86: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:105: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:112: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:119: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:133: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:142: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:148: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:154: Test is only applicable to aioredis 1.x
SKIPPED [2] test/test_aioredis1.py:159: Test is only applicable to aioredis 1.x
SKIPPED [14] test/test_aioredis2.py:39: Redis is not running
SKIPPED [514] test/conftest.py:51: Redis is not running
SKIPPED [1] test/test_fakeredis.py:4670: Test is only applicable if aioredis is not installed
SKIPPED [11] test/test_hypothesis.py:376: redis is not running
SKIPPED [2] test/test_lua.py:124: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_lua.py:159: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_lua.py:254: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:15: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:20: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:32: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:38: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:44: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:49: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:55: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:61: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:67: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:72: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:77: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:92: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:96: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:100: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:107: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:118: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:125: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:132: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:139: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:145: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:150: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:160: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:165: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:170: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:175: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:180: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:191: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:196: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:208: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:216: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:227: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:232: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:241: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:249: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:256: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:262: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:278: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:286: Test is only applicable to redis-py 3 and above
SKIPPED [2] test/test_redis2_only.py:296: Test is only applicable to redis-py 3 and above
SKIPPED [1] test/test_redis4_plus.py:16: Test is only applicable if aioredis is not installed
============================================================== 652 passed, 651 skipped, 5 warnings in 47.07s ===============================================================

kloczek avatar Jun 04 '22 19:06 kloczek

There is one warning that is relevant there:

  test/test_aioredis2.py:59: PytestWarning: The test <Function test_redis_asyncio_is_used> is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'.
    @testtools.run_test_if_redis_ver('above', '4.2')

The others seem to come from the _server.py implementation and are expected

cunla avatar Jun 04 '22 19:06 cunla

Just tested 1.8.1

====================================================================== warnings summary ======================================================================
test/test_fakeredis.py::test_hmset_empty_raises_error[FakeStrictRedis]
  /home/tkloczko/rpmbuild/BUILD/fakeredis-py-1.8.1/test/test_fakeredis.py:1557: DeprecationWarning: FakeStrictRedis.hmset() is deprecated. Use FakeStrictRedis.hset() instead.
    r.hmset('foo', {})

test/test_fakeredis.py::test_hmset[FakeStrictRedis]
  /home/tkloczko/rpmbuild/BUILD/fakeredis-py-1.8.1/test/test_fakeredis.py:1562: DeprecationWarning: FakeStrictRedis.hmset() is deprecated. Use FakeStrictRedis.hset() instead.
    assert r.hmset('foo', {'k2': 'v2', 'k3': 'v3'}) is True

test/test_fakeredis.py::test_hmset_wrong_type[FakeStrictRedis]
  /home/tkloczko/rpmbuild/BUILD/fakeredis-py-1.8.1/test/test_fakeredis.py:1568: DeprecationWarning: FakeStrictRedis.hmset() is deprecated. Use FakeStrictRedis.hset() instead.
    r.hmset('foo', {'key': 'value'})

test/test_fakeredis.py::TestFakeStrictRedisConnectionErrors::test_hmset[FakeStrictRedis]
  /home/tkloczko/rpmbuild/BUILD/fakeredis-py-1.8.1/test/test_fakeredis.py:4446: DeprecationWarning: FakeStrictRedis.hmset() is deprecated. Use FakeStrictRedis.hset() instead.
    r.hmset('name', {'key': 1})

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================== short test summary info ===================================================================

kloczek avatar Jun 06 '22 18:06 kloczek

@kloczek These warnings are equivalent to the behavior of redis-py: https://github.com/redis/redis-py/blob/3081a32b3852276999bb250655e4dfe2c87c654c/tests/test_commands.py#L2837-L2846

cunla avatar Jun 06 '22 18:06 cunla

Closing as this ticket is now outdated.

kloczek avatar May 18 '24 19:05 kloczek