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

PytestUnraisableExceptionWarning from asycio client #2660

Closed
ahgraber opened this issue Mar 23, 2023 · 0 comments · Fixed by #2669
Closed

PytestUnraisableExceptionWarning from asycio client #2660

ahgraber opened this issue Mar 23, 2023 · 0 comments · Fixed by #2669
Assignees
Labels
maintenance Maintenance (CI, Releases, etc)

Comments

@ahgraber
Copy link

ahgraber commented Mar 23, 2023

Version: What redis-py and what redis version is the issue happening on?

redis-py 4.3.4 and 4.5.3
redis 7.0.9

Platform: What platform / version? (For example Python 3.5.1 on Windows 7 / Ubuntu 15.10 / Azure)

Python 3.9.16 | packaged by conda-forge
[Clang 14.0.6 ] on darwin 

Occurs in both arm64 and Rosetta amd64 environments.

Description: Description of your issue, stack traces from errors and code that reproduces the issue

When running unit tests on a redis.asyncio.Redis object, I notice I keep getting PytestUnraisableExceptionWarning that is raised because of del() calling self.close() in Redis class, as the self.connection attribute was not set due to early failure in the Redis() constructor.

  /Users/me/mambaforge/envs/x86_ds_utils/lib/python3.9/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function Redis.__del__ at 0x17c0919d0>
  
  Traceback (most recent call last):
    File "/Users/me/mambaforge/envs/x86_ds_utils/lib/python3.9/site-packages/redis/asyncio/client.py", line 458, in __del__
      if self.connection is not None:
  AttributeError: 'RedisCache' object has no attribute 'connection'
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

I think this was fixed in the standard (non-async) Redis in #1458

@ahgraber ahgraber changed the title PytestUnraisableExceptionWarning from PytestUnraisableExceptionWarning from asycio client Mar 27, 2023
@dvora-h dvora-h added the maintenance Maintenance (CI, Releases, etc) label Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance (CI, Releases, etc)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants