Skip to content

Commit

Permalink
Fix some test stuff (#372)
Browse files Browse the repository at this point in the history
* fix(test): import error on chains without snx

* fix(test): event on wrong loop
  • Loading branch information
BobTheBuidler authored Sep 26, 2023
1 parent 4c4ad6d commit 016a2f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/prices/test_synthetix.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
async_synthetix = Synthetix(asynchronous=True)
SYNTHS = sync_synthetix.synths
except UnsupportedNetwork:
pass
SYNTHS = []

@mainnet_only
def test_get_synths():
Expand Down
7 changes: 6 additions & 1 deletion y/prices/chainlink.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import logging
from functools import cached_property
from typing import Dict, NoReturn, Optional, Union

import a_sync
Expand Down Expand Up @@ -177,9 +178,13 @@ def __init__(self, asynchronous: bool = False) -> None:
elif len(FEEDS) == 0:
raise UnsupportedNetwork('chainlink is not supported on this network')
self._cached_feeds = {ERC20(token, asynchronous=self.asynchronous): feed for token, feed in FEEDS.items()}
self._feeds_loaded = a_sync.Event()
self._loading = False

@cached_property
def _feeds_loaded(self) -> a_sync.Event:
"""A helper function to ensure the Event is attached to the correct loop."""
return a_sync.Event()

async def _start_feed_loop(self) -> Union[None, NoReturn]:
if self._loading:
return
Expand Down

0 comments on commit 016a2f5

Please sign in to comment.