Skip to content

Commit 3f4d08c

Browse files
committed
use test_instance
1 parent 8b44d5b commit 3f4d08c

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

test/ably/realtime/realtimepresence_test.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,31 +282,45 @@ class TestRealtimePresenceSubscribe(BaseAsyncTestCase):
282282
"""Test presence.subscribe() functionality."""
283283

284284
@pytest.fixture(autouse=True)
285-
async def setup(self, use_binary_protocol):
285+
async def setup(self, use_binary_protocol, request):
286286
"""Set up test fixtures."""
287-
self.test_vars = await TestApp.get_test_vars()
288-
self.use_binary_protocol = use_binary_protocol
287+
test_instance = request.instance
288+
289+
test_instance.test_vars = await TestApp.get_test_vars()
290+
test_instance.use_binary_protocol = use_binary_protocol
289291

290292
protocol = 'msgpack' if use_binary_protocol else 'json'
291293

292-
self.client1 = await TestApp.get_ably_realtime(
294+
test_instance.client1 = await TestApp.get_ably_realtime(
293295
client_id='client1',
294296
use_binary_protocol=use_binary_protocol
295297
)
296-
print(f"[{protocol}] FIXTURE SETUP: Created client1 id={id(self.client1)}, state={self.client1.connection.state}")
298+
print(
299+
f"[{protocol}] FIXTURE SETUP: Created client1 id={id(test_instance.client1)}, "
300+
f"state={test_instance.client1.connection.state}"
301+
)
297302

298-
self.client2 = await TestApp.get_ably_realtime(
303+
test_instance.client2 = await TestApp.get_ably_realtime(
299304
client_id='client2',
300305
use_binary_protocol=use_binary_protocol
301306
)
302-
print(f"[{protocol}] FIXTURE SETUP: Created client2 id={id(self.client2)}, state={self.client2.connection.state}")
307+
print(
308+
f"[{protocol}] FIXTURE SETUP: Created client2 id={id(test_instance.client2)}, "
309+
f"state={test_instance.client2.connection.state}"
310+
)
303311

304312
yield
305313

306-
print(f"[{protocol}] FIXTURE TEARDOWN: client1 id={id(self.client1)}, state={self.client1.connection.state}")
307-
print(f"[{protocol}] FIXTURE TEARDOWN: client2 id={id(self.client2)}, state={self.client2.connection.state}")
308-
await self.client1.close()
309-
await self.client2.close()
314+
print(
315+
f"[{protocol}] FIXTURE TEARDOWN: client1 id={id(test_instance.client1)}, "
316+
f"state={test_instance.client1.connection.state}"
317+
)
318+
print(
319+
f"[{protocol}] FIXTURE TEARDOWN: client2 id={id(test_instance.client2)}, "
320+
f"state={test_instance.client2.connection.state}"
321+
)
322+
await test_instance.client1.close()
323+
await test_instance.client2.close()
310324

311325
async def test_presence_subscribe_unattached(self):
312326
"""

0 commit comments

Comments
 (0)