Skip to content

Commit 85fcbe8

Browse files
odesenfansMHHukiewitz
authored andcommitted
Fix: remove aiohttp from TestVmCache __init__()
Problem: the aiohttp session is not required in this object. Solution: remove it from the base class constructor and use it only for the real VM cache.
1 parent 933900c commit 85fcbe8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/aleph_client/vm/cache.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class BaseVmCache(abc.ABC):
2323

2424
session: ClientSession
2525

26-
def __init__(self, session: Optional[ClientSession] = None):
27-
self.session = session or get_fallback_session()
28-
2926
@abc.abstractmethod
3027
async def get(self, key: str) -> Optional[bytes]:
3128
"""Get the value for a given key string."""
@@ -54,7 +51,7 @@ class VmCache(BaseVmCache):
5451
api_host: str
5552

5653
def __init__(self, session: Optional[ClientSession] = None, api_host: Optional[str] = None):
57-
super().__init__(session)
54+
self.session = session or get_fallback_session()
5855
self.cache = {}
5956
self.api_host = api_host if api_host else settings.API_HOST
6057

@@ -97,8 +94,7 @@ async def keys(self, pattern: str = "*") -> List[str]:
9794
class TestVmCache(BaseVmCache):
9895
"""This is a local, dict-based cache that can be used for testing purposes."""
9996

100-
def __init__(self, session: Optional[ClientSession] = None):
101-
super().__init__(session)
97+
def __init__(self):
10298
self._cache: Dict[str, bytes] = {}
10399

104100
async def get(self, key: str) -> Optional[bytes]:

0 commit comments

Comments
 (0)