Skip to content

Commit

Permalink
only skip in regtest
Browse files Browse the repository at this point in the history
  • Loading branch information
callebtc committed Nov 5, 2024
1 parent a1deda8 commit 283e5f5
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions tests/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from cashu.mint.ledger import Ledger
from cashu.wallet.wallet import Wallet
from tests.conftest import SERVER_ENDPOINT
from tests.helpers import is_github_actions, is_postgres, pay_if_regtest
from tests.helpers import is_github_actions, is_postgres, is_regtest, pay_if_regtest


async def assert_err(f, msg):
Expand Down Expand Up @@ -147,13 +147,10 @@ async def get_connection():

@pytest.mark.asyncio
@pytest.mark.skipif(
not settings.mint_database.startswith("postgres"),
not not is_postgres,
reason="SQLite does not support row locking",
)
async def test_db_get_connection_lock_row(wallet: Wallet, ledger: Ledger):
if ledger.db.type == db.SQLITE:
pytest.skip("SQLite does not support row locking")

mint_quote = await wallet.request_mint(64)

async def get_connection():
Expand Down Expand Up @@ -191,10 +188,8 @@ async def get_connection():

@pytest.mark.asyncio
@pytest.mark.skipif(
is_github_actions and not is_postgres,
reason=(
"Fails on GitHub Actions for some inexplicable reason, but only for SQLite"
),
is_github_actions and is_regtest and not is_postgres,
reason=("Fails on GitHub Actions for regtest + SQLite"),
)
async def test_db_verify_spent_proofs_and_set_pending_race_condition(
wallet: Wallet, ledger: Ledger
Expand All @@ -219,10 +214,8 @@ async def test_db_verify_spent_proofs_and_set_pending_race_condition(

@pytest.mark.asyncio
@pytest.mark.skipif(
is_github_actions and not is_postgres,
reason=(
"Fails on GitHub Actions for some inexplicable reason, but only for SQLite"
),
is_github_actions and is_regtest and not is_postgres,
reason=("Fails on GitHub Actions for regtest + SQLite"),
)
async def test_db_verify_spent_proofs_and_set_pending_delayed_no_race_condition(
wallet: Wallet, ledger: Ledger
Expand All @@ -248,10 +241,8 @@ async def delayed_verify_spent_proofs_and_set_pending():

@pytest.mark.asyncio
@pytest.mark.skipif(
is_github_actions and not is_postgres,
reason=(
"Fails on GitHub Actions for some inexplicable reason, but only for SQLite"
),
is_github_actions and is_regtest and not is_postgres,
reason=("Fails on GitHub Actions for regtest + SQLite"),
)
async def test_db_verify_spent_proofs_and_set_pending_no_race_condition_different_proofs(
wallet: Wallet, ledger: Ledger
Expand All @@ -271,7 +262,7 @@ async def test_db_verify_spent_proofs_and_set_pending_no_race_condition_differen

@pytest.mark.asyncio
@pytest.mark.skipif(
not settings.mint_database.startswith("postgres"),
not is_postgres,
reason="SQLite does not support row locking",
)
async def test_db_get_connection_lock_different_row(wallet: Wallet, ledger: Ledger):
Expand Down Expand Up @@ -320,10 +311,8 @@ async def get_connection2():

@pytest.mark.asyncio
@pytest.mark.skipif(
is_github_actions and not is_postgres,
reason=(
"Fails on GitHub Actions for some inexplicable reason, but only for SQLite"
),
is_github_actions and is_regtest and not is_postgres,
reason=("Fails on GitHub Actions for regtest + SQLite"),
)
async def test_db_lock_table(wallet: Wallet, ledger: Ledger):
# fill wallet
Expand Down

0 comments on commit 283e5f5

Please sign in to comment.