villebro commented on code in PR #29912:
URL: https://github.com/apache/superset/pull/29912#discussion_r1736706207


##########
tests/integration_tests/tasks/async_queries_tests.py:
##########
@@ -37,18 +43,37 @@
 )
 from tests.integration_tests.test_app import app
 
+# Define the cache backends once
+cache_backends = {
+    "RedisCacheBackend": mock.Mock(spec=RedisCacheBackend),
+    "RedisSentinelCacheBackend": mock.Mock(spec=RedisSentinelCacheBackend),
+    "redis.Redis": mock.Mock(spec=redis.Redis),
+}
+

Review Comment:
   I believe these are now redundant as we have the parametrized tests?
   ```suggestion
   # Define the cache backends once
   cache_backends = {
       "RedisCacheBackend": mock.Mock(spec=RedisCacheBackend),
       "RedisSentinelCacheBackend": mock.Mock(spec=RedisSentinelCacheBackend),
       "redis.Redis": mock.Mock(spec=redis.Redis),
   }
   
   ```



##########
tests/unit_tests/async_events/async_query_manager_tests.py:
##########
@@ -17,26 +17,37 @@
 from unittest import mock
 from unittest.mock import ANY, Mock
 
+import redis
 from flask import g
 from jwt import encode
-from pytest import fixture, raises
+from pytest import fixture, mark, raises
 
 from superset import security_manager
 from superset.async_events.async_query_manager import (
     AsyncQueryManager,
     AsyncQueryTokenException,
 )
+from superset.async_events.cache_backend import (
+    RedisCacheBackend,
+    RedisSentinelCacheBackend,
+)
 
 JWT_TOKEN_SECRET = "some_secret"
 JWT_TOKEN_COOKIE_NAME = "superset_async_jwt"
 
+# Define the cache backends once as mocks
+# cache_backends = {
+#    "RedisCacheBackend": mock.Mock(spec=RedisCacheBackend),
+#    "RedisSentinelCacheBackend": mock.Mock(spec=RedisSentinelCacheBackend),
+#    "redis.Redis": mock.Mock(spec=redis.Redis),
+# }
+

Review Comment:
   Same here:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to