Skip to content

Commit 15a6146

Browse files
committed
Move temp dir to base store tests
1 parent 8f05cc9 commit 15a6146

File tree

2 files changed

+10
-10
lines changed
  • key-value
    • key-value-aio/tests/stores
    • key-value-sync/tests/code_gen/stores

2 files changed

+10
-10
lines changed

key-value/key-value-aio/tests/stores/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ class BaseStoreTests(ABC):
2828
async def eventually_consistent(self) -> None: # noqa: B027
2929
"""Subclasses can override this to wait for eventually consistent operations."""
3030

31+
@pytest.fixture
32+
async def per_test_temp_dir(self) -> AsyncGenerator[Path, None]:
33+
with tempfile.TemporaryDirectory() as temp_dir:
34+
yield Path(temp_dir)
35+
3136
@pytest.fixture
3237
@abstractmethod
3338
async def store(self) -> BaseStore | AsyncGenerator[BaseStore, None]: ...
@@ -261,11 +266,6 @@ async def test_minimum_put_many_delete_many_performance(self, store: BaseStore):
261266

262267

263268
class ContextManagerStoreTestMixin:
264-
@pytest.fixture
265-
async def per_test_temp_dir(self) -> AsyncGenerator[Path, None]:
266-
with tempfile.TemporaryDirectory() as temp_dir:
267-
yield Path(temp_dir)
268-
269269
@pytest.fixture(params=[True, False], ids=["with_ctx_manager", "no_ctx_manager"], autouse=True)
270270
async def enter_exit_store(
271271
self, request: pytest.FixtureRequest, store: BaseContextManagerStore, per_test_temp_dir: Path

key-value/key-value-sync/tests/code_gen/stores/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ class BaseStoreTests(ABC):
2525
def eventually_consistent(self) -> None: # noqa: B027
2626
"Subclasses can override this to wait for eventually consistent operations."
2727

28+
@pytest.fixture
29+
def per_test_temp_dir(self) -> Generator[Path, None, None]:
30+
with tempfile.TemporaryDirectory() as temp_dir:
31+
yield Path(temp_dir)
32+
2833
@pytest.fixture
2934
@abstractmethod
3035
def store(self) -> BaseStore | Generator[BaseStore, None, None]: ...
@@ -258,11 +263,6 @@ def test_minimum_put_many_delete_many_performance(self, store: BaseStore):
258263

259264

260265
class ContextManagerStoreTestMixin:
261-
@pytest.fixture
262-
def per_test_temp_dir(self) -> Generator[Path, None, None]:
263-
with tempfile.TemporaryDirectory() as temp_dir:
264-
yield Path(temp_dir)
265-
266266
@pytest.fixture(params=[True, False], ids=["with_ctx_manager", "no_ctx_manager"], autouse=True)
267267
def enter_exit_store(
268268
self, request: pytest.FixtureRequest, store: BaseContextManagerStore, per_test_temp_dir: Path

0 commit comments

Comments
 (0)