From 9e39e58b583a9dcddae6772d5e18f782048195a2 Mon Sep 17 00:00:00 2001 From: Daniel Schiavini Date: Mon, 22 Jan 2024 16:57:10 +0100 Subject: [PATCH] Reset env between tests --- tests/conftest.py | 4 +++- tests/fixtures/accounts.py | 14 ++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index a62e6d61..f454c2b9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -18,9 +18,11 @@ ] -@pytest.fixture(scope="session", autouse=True) +@pytest.fixture(autouse=True) def fast_mode(): boa.env.enable_fast_mode() + yield + boa.reset_env() def pytest_generate_tests(metafunc): diff --git a/tests/fixtures/accounts.py b/tests/fixtures/accounts.py index bc48f355..e4f2b2f4 100644 --- a/tests/fixtures/accounts.py +++ b/tests/fixtures/accounts.py @@ -194,29 +194,27 @@ def meta_setup( underlying_tokens, pool_tokens, add_initial_liquidity_owner_meta, + metapool_token, ): approve_account(alice, pool_tokens, meta_swap) mint_account(alice, pool_tokens, initial_balance, meta_initial_amounts) mint_for_testing(bob, 1 * 10**18, None, True) - underlying_token = underlying_tokens[0] add_base_pool_liquidity(alice, base_pool, base_pool_tokens, base_pool_decimals) alice_bp_balance_norm = base_pool_lp_token.balanceOf(alice) / 10**18 - alice_mp_balance_norm = underlying_token.balanceOf(alice) / 10 ** underlying_token.decimals() + alice_mp_balance_norm = metapool_token.balanceOf(alice) / 10 ** metapool_token.decimals() if alice_mp_balance_norm < alice_bp_balance_norm: - mint_for_testing( - alice, int(math.ceil(alice_bp_balance_norm) * 10 ** underlying_token.decimals()), underlying_token - ) + mint_for_testing(alice, int(math.ceil(alice_bp_balance_norm) * 10 ** metapool_token.decimals()), metapool_token) with boa.env.prank(alice): - underlying_token.approve(meta_swap.address, 2**256 - 1) + metapool_token.approve(meta_swap.address, 2**256 - 1) base_pool_lp_token.approve(meta_swap.address, 2**256 - 1) meta_swap.add_liquidity(deposit_meta_amounts, 0) add_base_pool_liquidity(bob, base_pool, base_pool_tokens, base_pool_decimals) - mint_for_testing(bob, initial_balance, underlying_token, False) - assert underlying_token.balanceOf(bob) == pytest.approx(base_pool_lp_token.balanceOf(bob)) + mint_for_testing(bob, initial_balance, metapool_token, False) + assert metapool_token.balanceOf(bob) == pytest.approx(base_pool_lp_token.balanceOf(bob)) with boa.env.prank(bob): for underlying_token in underlying_tokens: