Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into drop-nulls-false-de…
Browse files Browse the repository at this point in the history
…fault
  • Loading branch information
gwaybio committed Jul 28, 2023
2 parents 3738237 + 4ffbe9f commit bb20837
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import itertools
import pathlib
import shutil
import tempfile
from shutil import copy
from typing import Any, Dict, List, Tuple, cast

Expand Down Expand Up @@ -546,20 +548,24 @@ def test_convert_s3_path_csv(


def test_convert_s3_path_sqlite(
get_tempdir: str,
data_dir_cellprofiler_sqlite_nf1: str,
example_s3_endpoint: str,
):
"""
Tests convert with mocked sqlite s3 object storage endpoint
Note: we use a dedicated tmpdir for work in this test to avoid
race conditions with nested pytest fixture post-yield deletions.
"""

tmpdir = tempfile.mkdtemp()

# local sqlite read
local_cytotable_table = parquet.read_table(
source=convert(
source_path=data_dir_cellprofiler_sqlite_nf1,
dest_path=(
f"{get_tempdir}/{pathlib.Path(data_dir_cellprofiler_sqlite_nf1).name}"
f"{tmpdir}/{pathlib.Path(data_dir_cellprofiler_sqlite_nf1).name}"
".cytotable.parquet"
),
dest_datatype="parquet",
Expand All @@ -573,7 +579,7 @@ def test_convert_s3_path_sqlite(
source=convert(
source_path=f"s3://example/nf1/{pathlib.Path(data_dir_cellprofiler_sqlite_nf1).name}",
dest_path=(
f"{get_tempdir}/{pathlib.Path(data_dir_cellprofiler_sqlite_nf1).name}"
f"{tmpdir}/{pathlib.Path(data_dir_cellprofiler_sqlite_nf1).name}"
".cytotable.parquet"
),
dest_datatype="parquet",
Expand All @@ -588,7 +594,7 @@ def test_convert_s3_path_sqlite(
source=convert(
source_path="s3://example/nf1/",
dest_path=(
f"{get_tempdir}/{pathlib.Path(data_dir_cellprofiler_sqlite_nf1).name}"
f"{tmpdir}/{pathlib.Path(data_dir_cellprofiler_sqlite_nf1).name}"
".cytotable.parquet"
),
dest_datatype="parquet",
Expand All @@ -613,6 +619,8 @@ def test_convert_s3_path_sqlite(
)
)

shutil.rmtree(path=tmpdir, ignore_errors=True)


def test_infer_source_group_common_schema(
example_local_sources: Dict[str, List[Dict[str, Any]]],
Expand Down

0 comments on commit bb20837

Please sign in to comment.