redis / redis-py

Redis Python client
MIT License
12.45k stars 2.48k forks source link

tests fail out of the box #3151

Open CarlFK opened 5 months ago

CarlFK commented 5 months ago

Something isn't right. I suspect I am not doing it right, like maybe I need to install docker, but it isn't clear.

On a fresh Debian lite:

sudo apt install python3-full git redis
git clone https://github.com/redis/redis-py.git
python3 -m venv venv
. venv/bin/activate
cd redis-py
pip3 install -r dev_requirements.txt
pip3 install -r requirements.txt
invoke tests

= 393 failed, 1844 passed, 1332 skipped, 849 deselected, 7 xfailed, 22 xpassed, 73 warnings, 14 errors in 310.91s (0:05:10) =

CarlFK commented 5 months ago

Installing docker did not lead to testing happiness.

(venv) root@base:/home/videoteam/redis-py# invoke devenv                                                      [354/622]
Stopping redis-cluster ...                                                                                             
Stopping redis-cluster ... done                                                                                        
Removing redis-standalone ...                                                                                          
Removing redis-cluster    ...                                                                                          
Removing redis-standalone ... done                                                                                     
Going to remove redis-standalone, redis-cluster
Removing redis-cluster    ... done
Creating redis-cluster ... 
Creating redis-standalone ...  
Creating redis-standalone ... done
Creating redis-replica    ...  
Creating redis-py_stunnel_1 ... 
Creating redis-sentinel2    ... 
Creating redis-sentinel3    ... 
Creating redis-sentinel     ... 
Creating redis-cluster      ... done
Creating redis-sentinel     ... done
Creating redis-py_stunnel_1 ... done
Creating redis-replica      ... done
Creating redis-sentinel3    ... done
Creating redis-sentinel2    ... done
Stopping redis-sentinel3    ... 
Stopping redis-replica      ... 
Stopping redis-sentinel     ... 
Stopping redis-sentinel2    ... 
Stopping redis-py_stunnel_1 ... 
Stopping redis-standalone   ... 
Stopping redis-cluster      ... 
Stopping redis-sentinel     ... done
Stopping redis-replica      ... done
Stopping redis-sentinel2    ... done
Stopping redis-py_stunnel_1 ... done
Stopping redis-sentinel3    ... done
Stopping redis-standalone   ... done
Stopping redis-cluster      ... done
Removing redis-sentinel3    ... 
Removing redis-replica      ... 
Removing redis-sentinel     ... 
Removing redis-sentinel2    ... 
Removing redis-py_stunnel_1 ... 
Removing redis-standalone   ... 
Removing redis-cluster      ... 
Removing redis-replica      ... done
Removing redis-sentinel     ... done
Removing redis-sentinel2    ... done
Removing redis-standalone   ... done
Removing redis-py_stunnel_1 ... done
Removing redis-cluster      ... done
Removing redis-sentinel3    ... done
Going to remove redis-sentinel3, redis-replica, redis-sentinel, redis-sentinel2, redis-py_stunnel_1, redis-standalone, 
redis-cluster
(venv) root@base:/home/videoteam/redis-py# invoke -l                                                          [301/622]
Available tasks:

  all-tests          Run all linters, and tests in redis-py.
  build-docs         Generates the sphinx documentation.
  clean              Stop all dockers, and clean up the built binaries, if generated.
  cluster-tests      Run tests against a redis cluster
  devenv             Brings up the test environment, by wrapping docker compose.
  linters            Run code linters
  package            Create the python packages
  standalone-tests   Run tests against a standalone redis instance
  tests              Run the redis-py test suite against the current python,

(venv) root@base:/home/videoteam/redis-py# invoke standalone-tests
============================= test session starts ==============================
platform linux -- Python 3.11.2, pytest-7.2.0, pluggy-1.4.0 
rootdir: /home/videoteam/redis-py, configfile: pytest.ini
plugins: cov-4.1.0, asyncio-0.23.5, timeout-2.1.0
asyncio: mode=Mode.AUTO
timeout: 30.0s
timeout method: signal
timeout func_only: False
collected 4454 items / 849 deselected / 3605 selected

tests/test_bloom.py EEEEEEEEEEEEEEEEEsEsEEEE
tests/test_cache.py EEEEEEE
tests/test_command_parser.py EEEEE
tests/test_commands.py EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEssEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
...
tests/test_asyncio/test_pubsub.py EFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEssEFEss
EFEssEFEssEFEssEFEssEFEssEFEssEFEssE.EssE.EssEFEssEFEssEFEssEFEssEFEssEFEssEFEssE.EssEFEssEFEssEFEssEFEssEFEssEFEssEFEs
sEFEssE                                                                                                                
INTERNALERROR> Traceback (most recent call last):                                                             [213/622]
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/_pytest/main.py", line 270, in wrap_session   
INTERNALERROR>     session.exitstatus = doit(config, session) or 0                                                     
INTERNALERROR>                          ^^^^^^^^^^^^^^^^^^^^^                                                          
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/_pytest/main.py", line 324, in _main          
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)     
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 501, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                       
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/pluggy/_manager.py", line 119, in _hookexec   
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)                                
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/pluggy/_callers.py", line 181, in _multicall
INTERNALERROR>     return outcome.get_result()                                                                         
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^                                                                         
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/pluggy/_result.py", line 99, in get_result    
INTERNALERROR>     raise exc.with_traceback(exc.__traceback__)
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/pluggy/_callers.py", line 102, in _multicall  
INTERNALERROR>     res = hook_impl.function(*args)                                                                     
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^                                                                     
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/_pytest/main.py", line 349, in pytest_runtestl
oop                                                                                                                    
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 501, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/pluggy/_manager.py", line 119, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
INTERNALERROR>     source = entry.getsource(self.astcache)                                                    [116/622]
INTERNALERROR>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                             
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/_pytest/_code/code.py", line 263, in getsource
INTERNALERROR>     astnode, _, end = getstatementrange_ast(                                                            
INTERNALERROR>                       ^^^^^^^^^^^^^^^^^^^^^^                                                            
INTERNALERROR>   File "/home/videoteam/venv/lib/python3.11/site-packages/_pytest/_code/source.py", line 185, in getstat
ementrange_ast                                                                                                         
INTERNALERROR>     astnode = ast.parse(content, "source", "exec")                                                      
INTERNALERROR>               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                      
INTERNALERROR>   File "/usr/lib/python3.11/ast.py", line 50, in parse                                                  
INTERNALERROR>     return compile(source, filename, mode, flags,                                                       
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/videoteam/venv/lib/python3.11/site-packages/_pytest/main.py:305: PluggyTeardownRaisedWarning: A plugin raised an 
exception during an old-style hookwrapper teardown.
Plugin: terminalreporter, Hook: pytest_sessionfinish
ConnectionError: Error connecting to localhost:6379. Multiple exceptions: [Errno 111] Connect call failed ('::1', 6379,
 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 6379).
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config.hook.pytest_sessionfinish(
INTERNALERROR> SystemError: AST constructor recursion depth mismatch (before=117, after=173)
Traceback (most recent call last):
  File "/home/videoteam/redis-py/redis/asyncio/connection.py", line 304, in connect
    await self.retry.call_with_retry(
  File "/home/videoteam/redis-py/redis/asyncio/retry.py", line 59, in call_with_retry
    return await do()
           ^^^^^^^^^^
  File "/home/videoteam/redis-py/redis/asyncio/connection.py", line 766, in _connect
    reader, writer = await asyncio.open_connection(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...

  File "/home/videoteam/redis-py/redis/asyncio/connection.py", line 1194, in ensure_connection                         
    await connection.connect()                                                                                         
  File "/home/videoteam/redis-py/redis/asyncio/connection.py", line 312, in connect                                    
    raise ConnectionError(self._error_message(e))                                                                      
redis.exceptions.ConnectionError: Error connecting to localhost:6379. Multiple exceptions: [Errno 111] Connect call fai
led ('::1', 6379, 0, 0), [Errno 111] Connect call failed ('127.0.0.1', 6379).                                          
(venv) root@base:/home/videoteam/redis-py# history                                                                     
gerzse commented 1 month ago

Hi @CarlFK ,

Do you still have this issue?

The two commands you used should do the job:

invoke devenv
invoke standalone-tests

In the output you pasted, I can see a block of Stopping ... and Removing .... That sounds like you take down the devenv (by running invoke clean?), and in that case the tests are expected to fail.

CarlFK commented 1 month ago

invoke devenv

Looking at what I posted, I don't think I did that.

I don't find any docs on how to run tests, so maybe that is the problem. Is this issue enough, or should I open a bug against the lack of testing docs?

CarlFK commented 1 month ago

so yes, if I try to run the tests they fail. so yes, there is still an issue.