From fdab722effa79c6063e5b40748409ac4048aa1b6 Mon Sep 17 00:00:00 2001 From: jp1ac4 <121959000+jp1ac4@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:01:38 +0000 Subject: [PATCH] func tests: run black --- tests/test_chain.py | 1 + tests/test_framework/utils.py | 2 +- tests/test_misc.py | 12 +++++++++--- tests/test_spend.py | 4 +++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/test_chain.py b/tests/test_chain.py index aeda76cb..fe9f5968 100644 --- a/tests/test_chain.py +++ b/tests/test_chain.py @@ -405,6 +405,7 @@ def test_conflicting_unconfirmed_spend_txs(lianad, bitcoind): if coin["spend_info"] is None: return False return coin["spend_info"]["txid"] == txid.hex() + wait_for(lambda: is_spent_by(lianad, spent_coin["outpoint"], txid_b)) diff --git a/tests/test_framework/utils.py b/tests/test_framework/utils.py index c599e211..f002b5dd 100644 --- a/tests/test_framework/utils.py +++ b/tests/test_framework/utils.py @@ -26,7 +26,7 @@ OLD_LIANAD_PATH = os.getenv("OLD_LIANAD_PATH", None) IS_BITCOIND_25 = bool(int(os.getenv("IS_BITCOIND_25", True))) -COIN = 10 ** 8 +COIN = 10**8 def wait_for(success, timeout=TIMEOUT, debug_fn=None): diff --git a/tests/test_misc.py b/tests/test_misc.py index a1b23e6b..0628c00b 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -274,7 +274,9 @@ def test_migration(lianad_multisig, bitcoind): assert len(spend_txs) == 2 and all(s["updated_at"] is not None for s in spend_txs) -@pytest.mark.skipif(not IS_BITCOIND_25, reason="Need 'generateblock' with 'submit=False'") +@pytest.mark.skipif( + not IS_BITCOIND_25, reason="Need 'generateblock' with 'submit=False'" +) def test_bitcoind_submit_block(bitcoind): block_count = bitcoind.rpc.getblockcount() block = bitcoind.rpc.generateblock(bitcoind.rpc.getnewaddress(), [], False) @@ -294,7 +296,9 @@ def bitcoind_wait_new_block(bitcoind): continue -@pytest.mark.skipif(not IS_BITCOIND_25, reason="Need 'generateblock' with 'submit=False'") +@pytest.mark.skipif( + not IS_BITCOIND_25, reason="Need 'generateblock' with 'submit=False'" +) def test_retry_on_workqueue_exceeded(lianad, bitcoind, executor): """Make sure we retry requests to bitcoind if it is temporarily overloaded.""" # Start by reducing the work queue to a single slot. Note we need to stop lianad @@ -363,5 +367,7 @@ def test_wo_wallet_copy_from_bitcoind_datadir(lianad, bitcoind): # Now restart lianad. It should detect it within the bitcoind datadir and copy it to its own. lianad.start() assert os.path.isdir(new_wo_path) - assert lianad.is_in_log("A data directory exists with no watchonly wallet. This is most likely due to.*") + assert lianad.is_in_log( + "A data directory exists with no watchonly wallet. This is most likely due to.*" + ) assert lianad.is_in_log("Successfully copied the watchonly wallet file.") diff --git a/tests/test_spend.py b/tests/test_spend.py index 1480133f..910c9ed2 100644 --- a/tests/test_spend.py +++ b/tests/test_spend.py @@ -391,5 +391,7 @@ def test_sweep(lianad, bitcoind): sign_and_broadcast_psbt(lianad, psbt) wait_for(lambda: len(lianad.rpc.listcoins(["unconfirmed"])["coins"]) == 1) wait_for(lambda: len(lianad.rpc.listcoins(["confirmed"])["coins"]) == 2) - balance = sum(c["amount"] for c in lianad.rpc.listcoins(["unconfirmed", "confirmed"])["coins"]) + balance = sum( + c["amount"] for c in lianad.rpc.listcoins(["unconfirmed", "confirmed"])["coins"] + ) assert balance == int((0.2 + 0.1 + 0.3) * COIN)