diff --git a/tests/test_mint_init.py b/tests/test_mint_init.py index e0a165d7..db7e2a79 100644 --- a/tests/test_mint_init.py +++ b/tests/test_mint_init.py @@ -17,6 +17,7 @@ cancel_invoice, get_hold_invoice, is_fake, + is_github_actions, is_regtest, pay_if_regtest, settle_invoice, @@ -26,6 +27,7 @@ DERIVATION_PATH = "m/0'/0'/0'" DECRYPTON_KEY = "testdecryptionkey" ENCRYPTED_SEED = "U2FsdGVkX1_7UU_-nVBMBWDy_9yDu4KeYb7MH8cJTYQGD4RWl82PALH8j-HKzTrI" +SLEEP_TIME = 1 if not is_github_actions else 2 async def assert_err(f, msg): @@ -282,7 +284,7 @@ async def test_startup_regtest_pending_quote_pending(wallet: Wallet, ledger: Led quote_id=quote.quote, ) ) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) # settle_invoice(preimage=preimage) # run startup routinge @@ -327,13 +329,13 @@ async def test_startup_regtest_pending_quote_success(wallet: Wallet, ledger: Led quote_id=quote.quote, ) ) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) # expect that proofs are pending states = await ledger.check_proofs_state([p.Y for p in send_proofs]) assert all([s.state == SpentState.pending for s in states]) settle_invoice(preimage=preimage) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) # run startup routinge await ledger.startup_ledger() @@ -377,14 +379,14 @@ async def test_startup_regtest_pending_quote_failure(wallet: Wallet, ledger: Led quote_id=quote.quote, ) ) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) # expect that proofs are pending states = await ledger.check_proofs_state([p.Y for p in send_proofs]) assert all([s.state == SpentState.pending for s in states]) cancel_invoice(preimage_hash=preimage_hash) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) # run startup routinge await ledger.startup_ledger() diff --git a/tests/test_mint_regtest.py b/tests/test_mint_regtest.py index 35ba4f1d..896ab5a9 100644 --- a/tests/test_mint_regtest.py +++ b/tests/test_mint_regtest.py @@ -10,10 +10,13 @@ from tests.helpers import ( get_hold_invoice, is_fake, + is_github_actions, pay_if_regtest, settle_invoice, ) +SLEEP_TIME = 1 if not is_github_actions else 2 + @pytest_asyncio.fixture(scope="function") async def wallet(): @@ -51,7 +54,7 @@ async def test_regtest_pending_quote(wallet: Wallet, ledger: Ledger): quote_id=quote.quote, ) ) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) # settle_invoice(preimage=preimage) # expect that melt quote is still pending @@ -66,7 +69,7 @@ async def test_regtest_pending_quote(wallet: Wallet, ledger: Ledger): # only now settle the invoice settle_invoice(preimage=preimage) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) # expect that proofs are now spent states = await ledger.check_proofs_state([p.Y for p in send_proofs]) diff --git a/tests/test_wallet_regtest.py b/tests/test_wallet_regtest.py index 7f3a2311..5ea3d431 100644 --- a/tests/test_wallet_regtest.py +++ b/tests/test_wallet_regtest.py @@ -12,10 +12,13 @@ cancel_invoice, get_hold_invoice, is_fake, + is_github_actions, pay_if_regtest, settle_invoice, ) +SLEEP_TIME = 1 if not is_github_actions else 2 + @pytest_asyncio.fixture(scope="function") async def wallet(): @@ -53,14 +56,14 @@ async def test_regtest_pending_quote(wallet: Wallet, ledger: Ledger): quote_id=quote.quote, ) ) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) states = await wallet.check_proof_state(send_proofs) assert all([s.state == SpentState.pending for s in states.states]) settle_invoice(preimage=preimage) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) states = await wallet.check_proof_state(send_proofs) assert all([s.state == SpentState.spent for s in states.states]) @@ -93,14 +96,14 @@ async def test_regtest_failed_quote(wallet: Wallet, ledger: Ledger): quote_id=quote.quote, ) ) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) states = await wallet.check_proof_state(send_proofs) assert all([s.state == SpentState.pending for s in states.states]) cancel_invoice(preimage_hash=preimage_hash) - await asyncio.sleep(1) + await asyncio.sleep(SLEEP_TIME) states = await wallet.check_proof_state(send_proofs) assert all([s.state == SpentState.unspent for s in states.states])