@@ -153,10 +153,19 @@ async def run():
153153 )
154154 )
155155 assert async_client ._api_client ._aiohttp_session is not None
156- assert not async_client ._api_client ._aiohttp_session .closed
156+ if hasattr (async_client ._api_client ._aiohttp_session , 'closed' ):
157+ assert not async_client ._api_client ._aiohttp_session .closed
157158 # Close the client and check that the session is closed.
158159 await async_client .aclose ()
159- assert async_client ._api_client ._aiohttp_session .closed
160+ if hasattr (async_client ._api_client ._aiohttp_session , 'closed' ):
161+ assert async_client ._api_client ._aiohttp_session .closed
162+ else :
163+ from google .auth .aio .transport .sessions import AsyncAuthorizedSession
164+
165+ if isinstance (
166+ async_client ._api_client ._aiohttp_session , AsyncAuthorizedSession
167+ ):
168+ assert async_client ._api_client ._aiohttp_session ._auth_request ._closed
160169
161170 asyncio .run (run ())
162171
@@ -197,8 +206,17 @@ async def run():
197206 )
198207 )
199208 assert async_client ._api_client ._aiohttp_session is not None
200- assert not async_client ._api_client ._aiohttp_session .closed
201-
202- assert async_client ._api_client ._aiohttp_session .closed
209+ if hasattr (async_client ._api_client ._aiohttp_session , 'closed' ):
210+ assert not async_client ._api_client ._aiohttp_session .closed
211+
212+ if hasattr (async_client ._api_client ._aiohttp_session , 'closed' ):
213+ assert async_client ._api_client ._aiohttp_session .closed
214+ else :
215+ from google .auth .aio .transport .sessions import AsyncAuthorizedSession
216+
217+ if isinstance (
218+ async_client ._api_client ._aiohttp_session , AsyncAuthorizedSession
219+ ):
220+ assert async_client ._api_client ._aiohttp_session ._auth_request ._closed
203221
204222 asyncio .run (run ())
0 commit comments