Skip to content

Commit 914ee4a

Browse files
committed
Better testing maybe
1 parent 10bece4 commit 914ee4a

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

.github/workflows/unit-and-integration-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ jobs:
5656
PYTHONUNBUFFERED: "1"
5757
run: |
5858
source venv/bin/activate
59-
python -m uv run pytest -n 2 tests/integration_tests/ --reruns 3
59+
python -m uv run pytest tests/integration_tests/ --reruns 3

tests/helpers/proxy_server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99

1010

1111
class ProxyServer:
12-
def __init__(self, upstream: str, time_til_pause: float, time_til_resume: float):
12+
def __init__(self, upstream: str, time_til_pause: float, time_til_resume: float, port: int = 8080):
1313
self.upstream_server = upstream
1414
self.time_til_pause = time_til_pause
1515
self.time_til_resume = time_til_resume
1616
self.upstream_connection = None
1717
self.connection_time = 0
1818
self.shutdown_time = 0
1919
self.resume_time = 0
20+
self.port = port
2021

2122
def connect(self):
2223
self.upstream_connection = connect(self.upstream_server)
@@ -41,7 +42,7 @@ def proxy_request(self, websocket: ServerConnection):
4142
websocket.send(recd)
4243

4344
def serve(self):
44-
with serve(self.proxy_request, "localhost", 8080) as self.server:
45+
with serve(self.proxy_request, "localhost", self.port) as self.server:
4546
self.server.serve_forever()
4647

4748
def connect_and_serve(self):

tests/integration_tests/test_async_substrate_interface.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ async def test_improved_reconnection():
210210
os.remove(asi_logger_path)
211211
logger.setLevel(logging.DEBUG)
212212
logger.addHandler(logging.FileHandler(asi_logger_path))
213-
214-
proxy = ProxyServer("wss://archive.sub.latent.to", 10, 20)
213+
port = 8079
214+
proxy = ProxyServer("wss://archive.sub.latent.to", 10, 20, port=port)
215215

216216
server_thread = threading.Thread(target=proxy.connect_and_serve, daemon=True)
217217
server_thread.start()
218218
await asyncio.sleep(3) # give the server start up time
219219
async with AsyncSubstrateInterface(
220-
"ws://localhost:8080",
220+
f"ws://localhost:{port}",
221221
ss58_format=42,
222222
chain_name="Bittensor",
223223
retry_timeout=10.0,

0 commit comments

Comments
 (0)