Skip to content

Commit 8361d73

Browse files
committed
Move slow tests to slow and fix test error when pyarrow is missing
1 parent 5d9b64e commit 8361d73

3 files changed

Lines changed: 63 additions & 11 deletions

File tree

tests/fast/pandas/test_import_cache.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
import importlib.util
2+
13
import pandas as pd
24
import pytest
35

46
import duckdb
57

68

7-
@pytest.mark.parametrize("string_dtype", ["python", "pyarrow"])
9+
@pytest.mark.parametrize(
10+
"string_dtype",
11+
[
12+
"python",
13+
pytest.param(
14+
"pyarrow", marks=pytest.mark.skipif(not importlib.util.find_spec("pyarrow"), reason="pyarrow not installed")
15+
),
16+
],
17+
)
818
def test_import_cache_explicit_dtype(string_dtype):
919
df = pd.DataFrame( # noqa: F841
1020
{

tests/fast/test_relation.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import datetime
33
import gc
44
import os
5-
import platform
65
import tempfile
76

87
import numpy as np
@@ -534,15 +533,6 @@ def test_relation_print(self):
534533
1024,
535534
2048,
536535
5000,
537-
1000000,
538-
pytest.param(
539-
10000000,
540-
marks=pytest.mark.skipif(
541-
condition=platform.system() == "Emscripten",
542-
reason="Emscripten/Pyodide builds run out of memory at this scale, and error might not "
543-
"thrown reliably",
544-
),
545-
),
546536
],
547537
)
548538
def test_materialized_relation(self, duckdb_cursor, num_rows):
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import platform
2+
3+
import pytest
4+
5+
6+
class TestMaterializedRelationSlow:
7+
@pytest.mark.parametrize(
8+
"num_rows",
9+
[
10+
1000000,
11+
pytest.param(
12+
10000000,
13+
marks=pytest.mark.skipif(
14+
condition=platform.system() == "Emscripten",
15+
reason="Emscripten/Pyodide builds run out of memory at this scale, and error might not "
16+
"thrown reliably",
17+
),
18+
),
19+
],
20+
)
21+
def test_materialized_relation(self, duckdb_cursor, num_rows):
22+
# Anything that is not a SELECT statement becomes a materialized relation, so we use `CALL`
23+
query = f"call repeat_row(42, 'test', 'this is a long string', true, num_rows={num_rows})"
24+
rel = duckdb_cursor.sql(query)
25+
res = rel.fetchone()
26+
assert res is not None
27+
28+
res = rel.fetchmany(num_rows)
29+
assert len(res) == num_rows - 1
30+
31+
res = rel.fetchmany(5)
32+
assert len(res) == 0
33+
res = rel.fetchmany(5)
34+
assert len(res) == 0
35+
res = rel.fetchone()
36+
assert res is None
37+
38+
rel.execute()
39+
res = rel.fetchone()
40+
assert res is not None
41+
42+
res = rel.fetchall()
43+
assert len(res) == num_rows - 1
44+
res = rel.fetchall()
45+
assert len(res) == num_rows
46+
47+
rel = duckdb_cursor.sql(query)
48+
projection = rel.select("column0")
49+
assert projection.fetchall() == [(42,) for _ in range(num_rows)]
50+
51+
filtered = rel.filter("column1 != 'test'")
52+
assert filtered.fetchall() == []

0 commit comments

Comments
 (0)