diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 423e908b..80f75dbc 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -192,3 +192,21 @@ jobs: - name: "Run tests" run: python -m unittest discover --start "./tests/" --pattern "test_offline_*.py" --verbose + + ruff: + name: "Lint tests" + runs-on: ubuntu-latest + defaults: + run: + working-directory: bdk-python + steps: + - name: "Checkout" + uses: actions/checkout@v4 + with: + submodules: true + + - name: "Install Ruff" + run: curl -LsSf https://astral.sh/ruff/install.sh | sh + + - name: "Lint test targets" + run: ruff check ./tests/ diff --git a/bdk-python/tests/test_live_kyoto.py b/bdk-python/tests/test_live_kyoto.py index 7a07aab0..3892c247 100644 --- a/bdk-python/tests/test_live_kyoto.py +++ b/bdk-python/tests/test_live_kyoto.py @@ -1,4 +1,4 @@ -from bdkpython import * +from bdkpython import Connection, Client, Network, Descriptor, KeychainKind, LightClientBuilder, LightClient, LightNode, IpAddress, ScanType, Peer, Update, Wallet import unittest import os import asyncio @@ -39,10 +39,16 @@ async def testKyoto(self) -> None: light_client: LightClient = LightClientBuilder().scan_type(ScanType.NEW()).peers(peers).connections(1).build(wallet) client: Client = light_client.client node: LightNode = light_client.node + async def log_loop(client: Client): + while True: + log = await client.next_log() + print(log) + log_task = asyncio.create_task(log_loop(client)) node.run() - update: Update = await client.update() + update: Update | None = await client.update() self.assertIsNotNone(update, "Update is None. This should not be possible.") - wallet.apply_update(update) + if update is not None: + wallet.apply_update(update) self.assertGreater( wallet.balance().total.to_sat(), 0,