Skip to content

Commit

Permalink
make sync fixtures not use async def (#10504)
Browse files Browse the repository at this point in the history
This is particularly relevant in cases where the scope is not function as
that forces use of a wider scoped event loop fixture as well.
  • Loading branch information
altendky authored Mar 8, 2022
1 parent 5eca464 commit 65deb79
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,45 +48,45 @@ def softfork_height(request):
block_format_version = "rc4"


@pytest_asyncio.fixture(scope="session")
async def default_400_blocks():
@pytest.fixture(scope="session")
def default_400_blocks():
from tests.util.blockchain import persistent_blocks

return persistent_blocks(400, f"test_blocks_400_{block_format_version}.db", seed=b"alternate2")


@pytest_asyncio.fixture(scope="session")
async def default_1000_blocks():
@pytest.fixture(scope="session")
def default_1000_blocks():
from tests.util.blockchain import persistent_blocks

return persistent_blocks(1000, f"test_blocks_1000_{block_format_version}.db")


@pytest_asyncio.fixture(scope="session")
async def pre_genesis_empty_slots_1000_blocks():
@pytest.fixture(scope="session")
def pre_genesis_empty_slots_1000_blocks():
from tests.util.blockchain import persistent_blocks

return persistent_blocks(
1000, f"pre_genesis_empty_slots_1000_blocks{block_format_version}.db", seed=b"alternate2", empty_sub_slots=1
)


@pytest_asyncio.fixture(scope="session")
async def default_10000_blocks():
@pytest.fixture(scope="session")
def default_10000_blocks():
from tests.util.blockchain import persistent_blocks

return persistent_blocks(10000, f"test_blocks_10000_{block_format_version}.db")


@pytest_asyncio.fixture(scope="session")
async def default_20000_blocks():
@pytest.fixture(scope="session")
def default_20000_blocks():
from tests.util.blockchain import persistent_blocks

return persistent_blocks(20000, f"test_blocks_20000_{block_format_version}.db")


@pytest_asyncio.fixture(scope="session")
async def default_10000_blocks_compact():
@pytest.fixture(scope="session")
def default_10000_blocks_compact():
from tests.util.blockchain import persistent_blocks

return persistent_blocks(
Expand All @@ -99,7 +99,7 @@ async def default_10000_blocks_compact():
)


@pytest_asyncio.fixture(scope="function")
async def tmp_dir():
@pytest.fixture(scope="function")
def tmp_dir():
with tempfile.TemporaryDirectory() as folder:
yield Path(folder)

0 comments on commit 65deb79

Please sign in to comment.