File tree Expand file tree Collapse file tree
rust/perspective-python/perspective/tests/virtual_servers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
1212
1313import os
14+ import tempfile
15+ import urllib .request
16+
1417import pytest
1518import duckdb
1619
1720from perspective import Client
1821from 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 ".." ,
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" )
3351def client ():
Original file line number Diff line number Diff line change 1111# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
1212
1313import os
14+ import tempfile
1415import pytest
1516import polars as pl
1617
1718from perspective import Client
1819from perspective .virtual_servers .polars import PolarsVirtualServer
20+ import urllib
1921
2022
2123def 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" )
4159def client ():
You can’t perform that action at this time.
0 commit comments