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

fix bucket tests #918

Merged
merged 1 commit into from
Jan 30, 2024
Merged
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
34 changes: 20 additions & 14 deletions tests/common/storages/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,26 @@ def assert_sample_files(
config: FilesystemConfiguration,
load_content: bool,
) -> None:
minimally_expected_file_items = {
"csv/freshman_kgs.csv",
"csv/freshman_lbs.csv",
"csv/mlb_players.csv",
"csv/mlb_teams_2012.csv",
"jsonl/mlb_players.jsonl",
"met_csv/A801/A881_20230920.csv",
"met_csv/A803/A803_20230919.csv",
"met_csv/A803/A803_20230920.csv",
"parquet/mlb_players.parquet",
"sample.txt",
}

assert len(all_file_items) >= 10
assert set([item["file_name"] for item in all_file_items]) >= minimally_expected_file_items

for item in all_file_items:
# only run tests on file items we know
if item["file_name"] not in minimally_expected_file_items:
continue
assert isinstance(item["file_name"], str)
assert item["file_url"].endswith(item["file_name"])
assert item["file_url"].startswith(config.protocol)
Expand All @@ -49,6 +68,7 @@ def assert_sample_files(
with file_dict.open() as f:
assert content == f.read()
# read via various readers
print(item)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sh-rp @sultaniman please do not let debug prints into the devel. if this goes into release we'll need a quick post release to fix it. and this is PITA :)

if item["mime_type"] == "text/csv":
# parse csv
with file_dict.open(mode="rt") as f:
Expand All @@ -67,20 +87,6 @@ def assert_sample_files(
assert len(lines) >= 1
assert isinstance(lines[0], str)

assert len(all_file_items) >= 10
assert set([item["file_name"] for item in all_file_items]) >= {
"csv/freshman_kgs.csv",
"csv/freshman_lbs.csv",
"csv/mlb_players.csv",
"csv/mlb_teams_2012.csv",
"jsonl/mlb_players.jsonl",
"met_csv/A801/A881_20230920.csv",
"met_csv/A803/A803_20230919.csv",
"met_csv/A803/A803_20230920.csv",
"parquet/mlb_players.parquet",
"sample.txt",
}


def start_loading_file(
s: LoadStorage, content: Sequence[StrAny], start_job: bool = True
Expand Down
Loading