Skip to content
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

3.5.3: pytest is failing #1478

Closed
kloczek opened this issue May 4, 2021 · 2 comments · Fixed by #1499
Closed

3.5.3: pytest is failing #1478

kloczek opened this issue May 4, 2021 · 2 comments · Fixed by #1499

Comments

@kloczek
Copy link

kloczek commented May 4, 2021

+ redis-server &
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-redis-3.5.3-3.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-redis-3.5.3-3.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/python3 -Bm pytest -ra
7864:C 04 May 2021 15:21:44.177 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7864:C 04 May 2021 15:21:44.177 # Redis version=6.2.2, bits=64, commit=00000000, modified=0, pid=7864, just started
7864:C 04 May 2021 15:21:44.177 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
7864:M 04 May 2021 15:21:44.179 * Increased maximum number of open files to 10032 (it was originally set to 1024).
7864:M 04 May 2021 15:21:44.179 * monotonic clock: POSIX clock_gettime
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.2.2 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 7864
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           https://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

7864:M 04 May 2021 15:21:44.180 # Server initialized
7864:M 04 May 2021 15:21:44.180 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
7864:M 04 May 2021 15:21:44.181 * Ready to accept connections
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: /home/tkloczko/rpmbuild/BUILD/redis-py-3.5.3
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, asyncio-0.14.0, expect-1.1.0, cov-2.11.1, mock-3.5.1, httpbin-1.0.0, xdist-2.2.1, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, pyfakefs-4.4.0, freezegun-0.4.2, cases-3.4.6, hypothesis-6.10.1, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, flaky-3.7.0
collected 475 items

tests/test_commands.py .......FF.................................................................................................................................... [ 29%]
......................................................................................................s.....................................                         [ 59%]
tests/test_connection.py .                                                                                                                                           [ 59%]
tests/test_connection_pool.py ................................................................                                                                       [ 72%]
tests/test_encoding.py ............                                                                                                                                  [ 75%]
tests/test_lock.py ..........................                                                                                                                        [ 80%]
tests/test_monitor.py .....                                                                                                                                          [ 81%]
tests/test_multiprocessing.py .........                                                                                                                              [ 83%]
tests/test_pipeline.py ........................                                                                                                                      [ 88%]
tests/test_pubsub.py ..................................                                                                                                              [ 96%]
tests/test_scripting.py .......                                                                                                                                      [ 97%]
tests/test_sentinel.py ............                                                                                                                                  [100%]

================================================================================= FAILURES =================================================================================
________________________________________________________________ TestRedisCommands.test_acl_getuser_setuser ________________________________________________________________

self = <tests.test_commands.TestRedisCommands object at 0x7ff010a40a00>, r = Redis<ConnectionPool<Connection<host=localhost,port=6379,db=9>>>
request = <FixtureRequest for <Function test_acl_getuser_setuser>>

    @skip_if_server_version_lt(REDIS_6_VERSION)
    def test_acl_getuser_setuser(self, r, request):
        username = 'redis-py-user'

        def teardown():
            r.acl_deluser(username)
        request.addfinalizer(teardown)

        # test enabled=False
        assert r.acl_setuser(username, enabled=False, reset=True)
>       assert r.acl_getuser(username) == {
            'categories': ['-@all'],
            'commands': [],
            'enabled': False,
            'flags': ['off'],
            'keys': [],
            'passwords': [],
        }
E       AssertionError: assert {'categories'...': False, ...} == {'categories'... ['off'], ...}
E         Omitting 5 identical items, use -vv to show
E         Differing items:
E         {'flags': ['off', 'allchannels', 'sanitize-payload']} != {'flags': ['off']}
E         Left contains 1 more item:
E         {'channels': [b'*']}
E         Use -v to get the full diff

tests/test_commands.py:108: AssertionError
_____________________________________________________________________ TestRedisCommands.test_acl_list ______________________________________________________________________

self = <tests.test_commands.TestRedisCommands object at 0x7ff0108dc4c0>, r = Redis<ConnectionPool<Connection<host=localhost,port=6379,db=9>>>
request = <FixtureRequest for <Function test_acl_list>>

    @skip_if_server_version_lt(REDIS_6_VERSION)
    def test_acl_list(self, r, request):
        username = 'redis-py-user'

        def teardown():
            r.acl_deluser(username)
        request.addfinalizer(teardown)

        assert r.acl_setuser(username, enabled=False, reset=True)
        users = r.acl_list()
>       assert 'user %s off -@all' % username in users
E       AssertionError: assert ('user %s off -@all' % 'redis-py-user') in ['user default on nopass ~* &* +@all', 'user redis-py-user off sanitize-payload &* -@all']

tests/test_commands.py:196: AssertionError
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_commands.py:1958: Redis version required < 4.0.0
FAILED tests/test_commands.py::TestRedisCommands::test_acl_getuser_setuser - AssertionError: assert {'categories'...': False, ...} == {'categories'... ['off'], ...}
FAILED tests/test_commands.py::TestRedisCommands::test_acl_list - AssertionError: assert ('user %s off -@all' % 'redis-py-user') in ['user default on nopass ~* &* +@all'...
================================================================ 2 failed, 472 passed, 1 skipped in 12.41s =================================================================
@kloczek
Copy link
Author

kloczek commented Jul 15, 2021

Thx however that PR does not applies correctly on top of last release.
Do you have any plans to make new release soon?

@chayim
Copy link
Contributor

chayim commented Jul 15, 2021

@kloczek Mind double-checking that you're up-to-date with what landed in master? The errors seeimingly do not contain the latest master, as your error above isn't what is currently on line 196+.I just re-ran what was merged in #1499 against redis 6.2.4, the latest release, below is my debug:

59941:C 15 Jul 2021 11:41:12.524 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
359941:C 15 Jul 2021 11:41:12.524 # Redis version=6.2.4, bits=64, commit=00000000, modified=0, pid=359941, just started
359941:C 15 Jul 2021 11:41:12.524 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
359941:M 15 Jul 2021 11:41:12.525 * Increased maximum number of open files to 10032 (it was originally set to 1024).
359941:M 15 Jul 2021 11:41:12.525 * monotonic clock: POSIX clock_gettime
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 6.2.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                  
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 359941
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           https://redis.io       
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

359941:M 15 Jul 2021 11:41:12.525 # Server initialized
359941:M 15 Jul 2021 11:41:12.525 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
359941:M 15 Jul 2021 11:41:12.525 * Loading RDB produced by version 6.2.4
359941:M 15 Jul 2021 11:41:12.525 * RDB age 37 seconds
359941:M 15 Jul 2021 11:41:12.525 * RDB memory usage when created 0.78 Mb
359941:M 15 Jul 2021 11:41:12.525 * DB loaded from disk: 0.000 seconds
359941:M 15 Jul 2021 11:41:12.525 * Ready to accept connections

To reproduce your environment, I grabbed python 3.8.9 with pyenv

> pyenv install 3.8.9
Downloading Python-3.8.9.tar.xz...
-> https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tar.xz
Installing Python-3.8.9...
Installed Python-3.8.9 to /home/chayim/.pyenv/versions/3.8.9
~/.pyenv/versions/3.8.9/bin/python -m venv venv389
source venv389/bin/activate
(venv389) python --version
Python 3.8.9

Next, I used the tox environment to build a fresh 3.8 environment, and run all of our tests:

tox -e py38
GLOB sdist-make: /data/repos/redis/redis-py/setup.py
py38 create: /data/repos/redis/redis-py/.tox/py38
py38 installdeps: coverage, pytest >= 2.7.0
WARNING: Discarding $PYTHONPATH from environment, to override specify PYTHONPATH in 'passenv' in your configuration.
py38 inst: /data/repos/redis/redis-py/.tox/.tmp/package/1/redis-3.5.3.zip
WARNING: Discarding $PYTHONPATH from environment, to override specify PYTHONPATH in 'passenv' in your configuration.
py38 installed: attrs==21.2.0,coverage==5.5,iniconfig==1.1.1,packaging==21.0,pluggy==0.13.1,py==1.10.0,pyparsing==2.4.7,pytest==6.2.4,redis==3.5.3,toml==0.10.2
py38 run-test-pre: PYTHONHASHSEED='489257788'
py38 run-test: commands[0] | /data/repos/redis/redis-py/.tox/py38/bin/python -b -m coverage run -p -m pytest -W always
==================================================================== test session starts =====================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
cachedir: .tox/py38/.pytest_cache
rootdir: /data/repos/redis/redis-py, configfile: tox.ini
collected 481 items                                                                                                                                          

tests/test_commands.py ......................................................................................................................................................................................................................................................s......................................
tests/test_connection.py .
tests/test_connection_pool.py ................................................................
tests/test_encoding.py ............
tests/test_lock.py ..........................
tests/test_monitor.py ......
tests/test_multiprocessing.py .........
tests/test_pipeline.py ........................
tests/test_pubsub.py ...................................
tests/test_scripting.py .......
tests/test_sentinel.py ............

============================================================== 480 passed, 1 skipped in 18.27s ===============================================================
py38 run-test: commands[1] | /data/repos/redis/redis-py/.tox/py38/bin/python -b -m coverage combine --append
__________________________________________________________________________ summary ___________________________________________________________________________
  py38: commands succeeded
  congratulations :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants