Skip to content

Commit

Permalink
Revert "implement fixture isolation"
Browse files Browse the repository at this point in the history
This reverts commit 0366835, there seem
to be some issues with fixture teardown order
  • Loading branch information
charles-cooper committed Mar 16, 2024
1 parent 9bc5856 commit 23898cb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
18 changes: 0 additions & 18 deletions boa/test/plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import contextlib
import warnings
from typing import Generator

import hypothesis
Expand Down Expand Up @@ -51,23 +50,6 @@ def pytest_collection_modifyitems(config, items):
item.add_marker("gas_profile")


_fixture_map = {}


def pytest_fixture_setup(fixturedef, request):
ctx = boa.env.anchor()
assert id(fixturedef) not in _fixture_map, "bad invariant"
_fixture_map[id(fixturedef)] = ctx
ctx.__enter__()


def pytest_fixture_post_finalizer(fixturedef, request):
if (ctx := _fixture_map.pop(id(fixturedef), None)) is not None:
ctx.__exit__(None, None, None)
else:
warnings.warn("possible bug in titanoboa! bad fixture tracking", stacklevel=1)


@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_call(item: pytest.Item) -> Generator:
ignore_isolation = item.get_closest_marker("ignore_isolation") is not None
Expand Down
13 changes: 0 additions & 13 deletions tests/unitary/test_isolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,3 @@ def setup_ignore_isolation(boa_contract):
def test_check_ignore_isolation(boa_contract, setup_ignore_isolation):
assert boa_contract.a() == 42069
assert boa_contract.b() == addr_constn


@pytest.fixture(scope="function")
def modify_boa_contract(boa_contract):
# these values spill over from the previous test
assert boa_contract.a() == 42069
assert boa_contract.b() == addr_constn
boa_contract.set_vars(boa_contract.a() + 1, boa.env.generate_address())


@pytest.mark.parametrize("a", range(10))
def test_fixture_isolation(modify_boa_contract, a):
pass

0 comments on commit 23898cb

Please sign in to comment.