Skip to content

Commit

Permalink
Revert unnecessary move
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Jan 31, 2024
1 parent f719c93 commit 6dd80dc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
25 changes: 24 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@
load_file_io,
)
from pyiceberg.io.fsspec import FsspecFileIO
from pyiceberg.manifest import DataFile, FileFormat
from pyiceberg.schema import Accessor, Schema
from pyiceberg.serializers import ToOutputFile
from pyiceberg.table import Table
from pyiceberg.table import FileScanTask, Table
from pyiceberg.table.metadata import TableMetadataV1, TableMetadataV2
from pyiceberg.types import (
BinaryType,
Expand Down Expand Up @@ -1904,6 +1905,28 @@ def clean_up(test_catalog: Catalog) -> None:
test_catalog.drop_namespace(database_name)


@pytest.fixture
def data_file(table_schema_simple: Schema, tmp_path: str) -> str:
import pyarrow as pa
from pyarrow import parquet as pq

table = pa.table(
{"foo": ["a", "b", "c"], "bar": [1, 2, 3], "baz": [True, False, None]},
metadata={"iceberg.schema": table_schema_simple.model_dump_json()},
)

file_path = f"{tmp_path}/0000-data.parquet"
pq.write_table(table=table, where=file_path)
return file_path


@pytest.fixture
def example_task(data_file: str) -> FileScanTask:
return FileScanTask(
data_file=DataFile(file_path=data_file, file_format=FileFormat.PARQUET, file_size_in_bytes=1925),
)


@pytest.fixture
def table_v1(example_table_metadata_v1: Dict[str, Any]) -> Table:
table_metadata = TableMetadataV1(**example_table_metadata_v1)
Expand Down
22 changes: 0 additions & 22 deletions tests/io/test_pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,6 @@
)


@pytest.fixture
def data_file(table_schema_simple: Schema, tmp_path: str) -> str:
import pyarrow as pa
from pyarrow import parquet as pq

table = pa.table(
{"foo": ["a", "b", "c"], "bar": [1, 2, 3], "baz": [True, False, None]},
metadata={"iceberg.schema": table_schema_simple.model_dump_json()},
)

file_path = f"{tmp_path}/0000-data.parquet"
pq.write_table(table=table, where=file_path)
return file_path


@pytest.fixture
def example_task(data_file: str) -> FileScanTask:
return FileScanTask(
data_file=DataFile(file_path=data_file, file_format=FileFormat.PARQUET, file_size_in_bytes=1925),
)


def test_pyarrow_infer_local_fs_from_path() -> None:
"""Test path with `file` scheme and no scheme both use LocalFileSystem"""
assert isinstance(PyArrowFileIO().new_output("file://tmp/warehouse")._filesystem, LocalFileSystem)
Expand Down

0 comments on commit 6dd80dc

Please sign in to comment.