-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored to support Parallel/Collect
- Loading branch information
zilto
authored and
zilto
committed
Oct 28, 2024
1 parent
4273aba
commit e1a7b00
Showing
6 changed files
with
102 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
|
||
from hamilton.caching.stores.file import FileResultStore | ||
from hamilton.caching.stores.memory import InMemoryResultStore | ||
|
||
|
||
def _instantiate_result_store(result_store_cls, tmp_path): | ||
if result_store_cls == FileResultStore: | ||
return FileResultStore(path=tmp_path) | ||
elif result_store_cls == InMemoryResultStore: | ||
return InMemoryResultStore() | ||
else: | ||
raise ValueError( | ||
f"Class `{result_store_cls}` isn't defined in `_instantiate_metadata_store()`" | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def result_store(request, tmp_path): | ||
result_store_cls = request.param | ||
result_store = _instantiate_result_store(result_store_cls, tmp_path) | ||
|
||
yield result_store | ||
|
||
result_store.delete_all() | ||
|
||
|
||
# NOTE add tests that check properties shared across result store implementations below |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters