diff --git a/gcsfs/core.py b/gcsfs/core.py index 3000e8f5..a7f023d1 100644 --- a/gcsfs/core.py +++ b/gcsfs/core.py @@ -500,13 +500,15 @@ async def _call( self, method, path, *args, json_out=False, info_out=False, **kwargs ): logger.debug(f"{method.upper()}: {path}, {args}, {kwargs}") - self.maybe_refresh() - path, jsonin, datain, headers, kwargs = self._get_args(path, *args, **kwargs) for retry in range(self.retries): try: if retry > 0: await asyncio.sleep(min(random.random() + 2 ** (retry - 1), 32)) + self.maybe_refresh() + path, jsonin, datain, headers, kwargs = self._get_args( + path, *args, **kwargs + ) async with self.session.request( method=method, url=path, @@ -1152,14 +1154,12 @@ def find(self, path, withdirs=False, detail=False, prefix="", **kwargs): ) if not out and key: try: - out = [ - sync( - self.loop, - self._get_object, - path, - callback_timeout=self.callback_timeout, - ) - ] + out = sync( + self.loop, + self._get_object, + path, + callback_timeout=self.callback_timeout, + ) except FileNotFoundError: out = [] dirs = [] diff --git a/gcsfs/tests/conftest.py b/gcsfs/tests/conftest.py index 3c366930..e748b7be 100644 --- a/gcsfs/tests/conftest.py +++ b/gcsfs/tests/conftest.py @@ -5,6 +5,11 @@ import vcr.stubs.aiohttp_stubs as aios +import fsspec.config + +fsspec.config.conf.pop("gcs", None) + + @pytest.yield_fixture def token_restore(): cache = GCSFileSystem.tokens