Skip to content

Commit 55a7c3a

Browse files
committed
Rename PythdClient to PythAgentClient
1 parent cb5b67d commit 55a7c3a

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

integration-tests/tests/test_integration.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
asyncio.set_event_loop(asyncio.new_event_loop())
7777

7878

79-
class PythdClient:
79+
class PythAgentClient:
8080

8181
def __init__(self, address: str) -> None:
8282
self.address: str = address
@@ -86,15 +86,16 @@ async def connect(self) -> Server:
8686
self.server = Server(self.address)
8787
task = await self.server.ws_connect()
8888
task.add_done_callback(self._on_connection_done)
89-
LOGGER.debug("connected to pythd websocket server at %s", self.address)
89+
LOGGER.debug(
90+
"connected to pyth agent websocket server at %s", self.address)
9091

9192
async def close(self) -> None:
9293
await self.server.close()
93-
LOGGER.debug("closed pythd connection")
94+
LOGGER.debug("closed pyth agent websocket connection")
9495

9596
@staticmethod
9697
def _on_connection_done(task):
97-
LOGGER.debug("pythd connection closed")
98+
LOGGER.debug("pyth agent connection closed")
9899
if not task.cancelled() and task.exception() is not None:
99100
e = task.exception()
100101
LOGGER.error(e, exc_info=1)
@@ -311,19 +312,19 @@ def agent(self, sync_accounts, agent_keystore, tmp_path):
311312
yield
312313

313314
@pytest_asyncio.fixture
314-
async def pythd(self, agent):
315-
pythd = PythdClient(address="ws://localhost:8910")
316-
await pythd.connect()
317-
yield pythd
318-
await pythd.close()
315+
async def client(self, agent):
316+
client = PythAgentClient(address="ws://localhost:8910")
317+
await client.connect()
318+
yield client
319+
await client.close()
319320

320321

321322
class TestUpdatePrice(PythTest):
322323

323324
@pytest.mark.asyncio
324-
async def test_update_price_simple(self, pythd: PythdClient):
325+
async def test_update_price_simple(self, client: PythAgentClient):
325326
# Fetch all products
326-
products = {product["attr_dict"]["symbol"]: product for product in await pythd.get_all_products()}
327+
products = {product["attr_dict"]["symbol"]: product for product in await client.get_all_products()}
327328

328329
# Find the product account ID corresponding to the BTC/USD symbol
329330
product = products[BTC_USD["attr_dict"]["symbol"]]
@@ -333,15 +334,15 @@ async def test_update_price_simple(self, pythd: PythdClient):
333334
price_account = product["price_accounts"][0]["account"]
334335

335336
# Send an "update_price" request
336-
await pythd.update_price(price_account, 42, 2, "trading")
337+
await client.update_price(price_account, 42, 2, "trading")
337338
time.sleep(2)
338339

339340
# Send another "update_price" request to trigger aggregation
340-
await pythd.update_price(price_account, 81, 1, "trading")
341+
await client.update_price(price_account, 81, 1, "trading")
341342
time.sleep(2)
342343

343344
# Confirm that the price account has been updated with the values from the first "update_price" request
344-
product = await pythd.get_product(product_account)
345+
product = await client.get_product(product_account)
345346
price_account = product["price_accounts"][0]
346347
assert price_account["price"] == 42
347348
assert price_account["conf"] == 2

0 commit comments

Comments
 (0)