diff --git a/rust/perspective-python/perspective/tests/virtual_servers/test_duckdb.py b/rust/perspective-python/perspective/tests/virtual_servers/test_duckdb.py index 742d707786..d9917f3ebd 100644 --- a/rust/perspective-python/perspective/tests/virtual_servers/test_duckdb.py +++ b/rust/perspective-python/perspective/tests/virtual_servers/test_duckdb.py @@ -11,14 +11,16 @@ # ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ import os +import tempfile +import urllib.request + import pytest import duckdb from perspective import Client from perspective.virtual_servers.duckdb import DuckDBVirtualServer - -SUPERSTORE_PARQUET = os.path.join( +_SUPERSTORE_LOCAL = os.path.join( os.path.dirname(__file__), "..", "..", @@ -28,6 +30,22 @@ "superstore.parquet", ) +_SUPERSTORE_URL = ( + "https://cdn.jsdelivr.net/npm/superstore-arrow@3.2.0/superstore.parquet" +) + + +def _get_superstore_parquet(): + if os.path.exists(_SUPERSTORE_LOCAL): + return _SUPERSTORE_LOCAL + path = os.path.join(tempfile.gettempdir(), "superstore.parquet") + if not os.path.exists(path): + urllib.request.urlretrieve(_SUPERSTORE_URL, path) + return path + + +SUPERSTORE_PARQUET = _get_superstore_parquet() + @pytest.fixture(scope="module") def client(): diff --git a/rust/perspective-python/perspective/tests/virtual_servers/test_polars.py b/rust/perspective-python/perspective/tests/virtual_servers/test_polars.py index a5b98b9bc9..d2a7a2820d 100644 --- a/rust/perspective-python/perspective/tests/virtual_servers/test_polars.py +++ b/rust/perspective-python/perspective/tests/virtual_servers/test_polars.py @@ -11,11 +11,13 @@ # ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ import os +import tempfile import pytest import polars as pl from perspective import Client from perspective.virtual_servers.polars import PolarsVirtualServer +import urllib def approx_json(expected): @@ -26,7 +28,7 @@ def approx_json(expected): ] -SUPERSTORE_PARQUET = os.path.join( +_SUPERSTORE_LOCAL = os.path.join( os.path.dirname(__file__), "..", "..", @@ -36,6 +38,22 @@ def approx_json(expected): "superstore.parquet", ) +_SUPERSTORE_URL = ( + "https://cdn.jsdelivr.net/npm/superstore-arrow@3.2.0/superstore.parquet" +) + + +def _get_superstore_parquet(): + if os.path.exists(_SUPERSTORE_LOCAL): + return _SUPERSTORE_LOCAL + path = os.path.join(tempfile.gettempdir(), "superstore.parquet") + if not os.path.exists(path): + urllib.request.urlretrieve(_SUPERSTORE_URL, path) + return path + + +SUPERSTORE_PARQUET = _get_superstore_parquet() + @pytest.fixture(scope="module") def client():