Skip to content

Commit

Permalink
Move test
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Jul 11, 2024
1 parent 2ff07f8 commit 1705985
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
17 changes: 14 additions & 3 deletions py-polars/tests/unit/io/cloud/test_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,21 @@


@pytest.mark.slow()
@pytest.mark.parametrize("format", ["parquet", "csv", "ipc"])
def test_scan_retries_zero(format: str) -> None:
@pytest.mark.parametrize("format", ["parquet", "csv", "ndjson", "ipc"])
def test_scan_nonexistent_cloud_path_17444(format: str) -> None:
# https://github.com/pola-rs/polars/issues/17444

path_str = f"s3://my-nonexistent-bucket/data.{format}"
scan_function = getattr(pl, f"scan_{format}")

# Just calling the scan function should not raise any errors
if format == "ndjson":
# NDJSON does not have a `retries` parameter yet - so use the default
result = scan_function(path_str)
else:
result = scan_function(path_str, retries=0)
assert isinstance(result, pl.LazyFrame)

# Upon collection, it should fail
with pytest.raises(ComputeError):
scan_function(path_str, retries=0).collect()
result.collect()
22 changes: 0 additions & 22 deletions py-polars/tests/unit/io/test_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import pytest

import polars as pl
from polars.exceptions import ComputeError
from polars.testing.asserts.frame import assert_frame_equal

if TYPE_CHECKING:
Expand Down Expand Up @@ -587,24 +586,3 @@ def test_scan_nonexistent_path(format: str) -> None:
# Upon collection, it should fail
with pytest.raises(FileNotFoundError):
result.collect()


@pytest.mark.slow()
@pytest.mark.parametrize("format", ["parquet", "csv", "ndjson", "ipc"])
def test_scan_nonexistent_cloud_path_17444(format: str) -> None:
# https://github.com/pola-rs/polars/issues/17444

path_str = f"s3://my-nonexistent-bucket/data.{format}"
scan_function = getattr(pl, f"scan_{format}")

# Just calling the scan function should not raise any errors
if format == "ndjson":
# NDJSON does not have a `retries` parameter yet - so use the default
result = scan_function(path_str)
else:
result = scan_function(path_str, retries=0)
assert isinstance(result, pl.LazyFrame)

# Upon collection, it should fail
with pytest.raises(ComputeError):
result.collect()

0 comments on commit 1705985

Please sign in to comment.