Skip to content

Commit d2c77a4

Browse files
committed
Fix Python sdist tests in CI
Signed-off-by: Andrew Stein <steinlink@gmail.com>
1 parent bfc12d8 commit d2c77a4

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

rust/perspective-python/perspective/tests/virtual_servers/test_duckdb.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
1212

1313
import os
14+
import tempfile
15+
import urllib.request
16+
1417
import pytest
1518
import duckdb
1619

1720
from perspective import Client
1821
from perspective.virtual_servers.duckdb import DuckDBVirtualServer
1922

20-
21-
SUPERSTORE_PARQUET = os.path.join(
23+
_SUPERSTORE_LOCAL = os.path.join(
2224
os.path.dirname(__file__),
2325
"..",
2426
"..",
@@ -28,6 +30,22 @@
2830
"superstore.parquet",
2931
)
3032

33+
_SUPERSTORE_URL = (
34+
"https://cdn.jsdelivr.net/npm/superstore-arrow@3.2.0/superstore.parquet"
35+
)
36+
37+
38+
def _get_superstore_parquet():
39+
if os.path.exists(_SUPERSTORE_LOCAL):
40+
return _SUPERSTORE_LOCAL
41+
path = os.path.join(tempfile.gettempdir(), "superstore.parquet")
42+
if not os.path.exists(path):
43+
urllib.request.urlretrieve(_SUPERSTORE_URL, path)
44+
return path
45+
46+
47+
SUPERSTORE_PARQUET = _get_superstore_parquet()
48+
3149

3250
@pytest.fixture(scope="module")
3351
def client():

rust/perspective-python/perspective/tests/virtual_servers/test_polars.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
1212

1313
import os
14+
import tempfile
1415
import pytest
1516
import polars as pl
1617

1718
from perspective import Client
1819
from perspective.virtual_servers.polars import PolarsVirtualServer
20+
import urllib
1921

2022

2123
def approx_json(expected):
@@ -26,7 +28,7 @@ def approx_json(expected):
2628
]
2729

2830

29-
SUPERSTORE_PARQUET = os.path.join(
31+
_SUPERSTORE_LOCAL = os.path.join(
3032
os.path.dirname(__file__),
3133
"..",
3234
"..",
@@ -36,6 +38,22 @@ def approx_json(expected):
3638
"superstore.parquet",
3739
)
3840

41+
_SUPERSTORE_URL = (
42+
"https://cdn.jsdelivr.net/npm/superstore-arrow@3.2.0/superstore.parquet"
43+
)
44+
45+
46+
def _get_superstore_parquet():
47+
if os.path.exists(_SUPERSTORE_LOCAL):
48+
return _SUPERSTORE_LOCAL
49+
path = os.path.join(tempfile.gettempdir(), "superstore.parquet")
50+
if not os.path.exists(path):
51+
urllib.request.urlretrieve(_SUPERSTORE_URL, path)
52+
return path
53+
54+
55+
SUPERSTORE_PARQUET = _get_superstore_parquet()
56+
3957

4058
@pytest.fixture(scope="module")
4159
def client():

0 commit comments

Comments
 (0)