diff --git a/cashu/mint/startup.py b/cashu/mint/startup.py index 769edcf0..35635258 100644 --- a/cashu/mint/startup.py +++ b/cashu/mint/startup.py @@ -16,6 +16,11 @@ from ..mint.crud import LedgerCrudSqlite from ..mint.ledger import Ledger +# kill the program if python runs in non-__debug__ mode +# which could lead to asserts not being executed for optimized code +if not __debug__: + raise Exception("Nutshell cannot run in non-debug mode.") + logger.debug("Enviroment Settings:") for key, value in settings.dict().items(): if key in [ diff --git a/tests/helpers.py b/tests/helpers.py index 456ab21b..9db520f0 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -32,6 +32,7 @@ async def get_random_invoice_data(): is_deprecated_api_only = settings.debug_mint_only_deprecated is_github_actions = os.getenv("GITHUB_ACTIONS") == "true" is_postgres = settings.mint_database.startswith("postgres") +SLEEP_TIME = 1 if not is_github_actions else 3 docker_lightning_cli = [ "docker", diff --git a/tests/test_mint_init.py b/tests/test_mint_init.py index db7e2a79..7bc45676 100644 --- a/tests/test_mint_init.py +++ b/tests/test_mint_init.py @@ -14,10 +14,10 @@ from cashu.wallet.wallet import Wallet from tests.conftest import SERVER_ENDPOINT from tests.helpers import ( + SLEEP_TIME, cancel_invoice, get_hold_invoice, is_fake, - is_github_actions, is_regtest, pay_if_regtest, settle_invoice, @@ -27,7 +27,6 @@ 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): diff --git a/tests/test_mint_regtest.py b/tests/test_mint_regtest.py index 896ab5a9..82890e46 100644 --- a/tests/test_mint_regtest.py +++ b/tests/test_mint_regtest.py @@ -8,15 +8,13 @@ from cashu.wallet.wallet import Wallet from tests.conftest import SERVER_ENDPOINT from tests.helpers import ( + SLEEP_TIME, 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(): diff --git a/tests/test_wallet_regtest.py b/tests/test_wallet_regtest.py index 5ea3d431..7a8c61cb 100644 --- a/tests/test_wallet_regtest.py +++ b/tests/test_wallet_regtest.py @@ -9,16 +9,14 @@ from cashu.wallet.wallet import Wallet from tests.conftest import SERVER_ENDPOINT from tests.helpers import ( + SLEEP_TIME, 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():