Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -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__),
"..",
"..",
Expand All @@ -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():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -26,7 +28,7 @@ def approx_json(expected):
]


SUPERSTORE_PARQUET = os.path.join(
_SUPERSTORE_LOCAL = os.path.join(
os.path.dirname(__file__),
"..",
"..",
Expand All @@ -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():
Expand Down
Loading