Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running all tests in python3.7 #105

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions test/test_driver/test_data_frame.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from __future__ import annotations

import pandas as pd
from pandas import DataFrame
import pytest
from _pytest.fixtures import SubRequest as Request
from pandas import DataFrame

from squirrel.constants import URL
from squirrel.catalog.source import Source
from squirrel.catalog.catalog import CatalogSource
from squirrel.catalog.source import Source
from squirrel.constants import URL
from squirrel.driver.data_frame import ENGINE
from squirrel.iterstream import IterableSource

Expand Down
22 changes: 14 additions & 8 deletions test/test_driver/test_msgpack.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import shutil
import tempfile

import torch.utils.data as tud

from squirrel.constants import URL
from squirrel.driver import MessagepackDriver
from squirrel.iterstream import IterableSource
from squirrel.iterstream.torch_composables import TorchIterable, SplitByWorker
from squirrel.iterstream.torch_composables import SplitByWorker, TorchIterable
from squirrel.serialization import MessagepackSerializer
from squirrel.store import SquirrelStore

Expand Down Expand Up @@ -36,13 +37,18 @@ def test_get_iter(dummy_msgpack_store: SquirrelStore, num_samples: int) -> None:

def test_clean_store() -> None:
"""Test instantiating a store and removing all it's content"""
with tempfile.TemporaryDirectory() as tmp_dir:
AlirezaSohofi marked this conversation as resolved.
Show resolved Hide resolved
_ = SquirrelStore(tmp_dir, clean=True, serializer=MessagepackSerializer())
driver = MessagepackDriver(url=tmp_dir)
IterableSource([{f"k{i}": f"v{i}"} for i in range(4)]).batched(2).async_map(driver.store.set).join()
assert len(list(driver.store.keys())) == 2
store = SquirrelStore(tmp_dir, clean=True, serializer=MessagepackSerializer())
assert len(list(store.keys())) == 0
tmp_dir = tempfile.mkdtemp()
_ = SquirrelStore(tmp_dir, clean=True, serializer=MessagepackSerializer())
driver = MessagepackDriver(url=tmp_dir)
IterableSource([{f"k{i}": f"v{i}"} for i in range(4)]).batched(2).async_map(driver.store.set).join()
assert len(list(driver.store.keys())) == 2
store = SquirrelStore(tmp_dir, clean=True, serializer=MessagepackSerializer())
assert len(list(store.keys())) == 0

try:
shutil.rmtree(tmp_dir)
except FileNotFoundError:
pass


def test_shard_no_key() -> None:
Expand Down