File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -173,8 +173,8 @@ async def __aenter__(self):
173
173
f"[magenta]Connecting to Substrate:[/magenta] [blue]{ self } [/blue][magenta]...[/magenta]"
174
174
)
175
175
try :
176
- async with self .substrate :
177
- return self
176
+ await self .substrate . initialize ()
177
+ return self
178
178
except TimeoutError :
179
179
logging .error (
180
180
f"[red]Error[/red]: Timeout occurred connecting to substrate."
Original file line number Diff line number Diff line change @@ -128,9 +128,8 @@ async def test_async_subtensor_magic_methods(mocker):
128
128
pass
129
129
130
130
# Asserts
131
- fake_async_substrate .__aenter__ .assert_called_once ()
132
- fake_async_substrate .__aexit__ .assert_called_once ()
133
- fake_async_substrate .close .assert_awaited_once ()
131
+ fake_async_substrate .initialize .assert_called_once ()
132
+ fake_async_substrate .close .assert_called_once ()
134
133
135
134
136
135
@pytest .mark .parametrize (
@@ -145,7 +144,7 @@ async def test_async_subtensor_aenter_connection_refused_error(
145
144
# Preps
146
145
fake_async_substrate = mocker .AsyncMock (
147
146
autospec = async_subtensor .AsyncSubstrateInterface ,
148
- __aenter__ = mocker .AsyncMock (side_effect = error ),
147
+ initialize = mocker .AsyncMock (side_effect = error ),
149
148
)
150
149
mocker .patch .object (
151
150
async_subtensor , "AsyncSubstrateInterface" , return_value = fake_async_substrate
@@ -158,7 +157,7 @@ async def test_async_subtensor_aenter_connection_refused_error(
158
157
pass
159
158
160
159
# Asserts
161
- fake_async_substrate .__aenter__ . assert_called_once ()
160
+ fake_async_substrate .initialize . assert_awaited_once ()
162
161
163
162
164
163
@pytest .mark .asyncio
You can’t perform that action at this time.
0 commit comments