|
2 | 2 | import sys |
3 | 3 | from pathlib import Path |
4 | 4 |
|
5 | | -import adbc_driver_manager.dbapi |
6 | 5 | import numpy as np |
7 | 6 | import pyarrow |
8 | 7 | import pytest |
9 | 8 |
|
10 | | -import adbc_driver_duckdb.dbapi |
| 9 | +import adbc_driver_duckdb |
11 | 10 |
|
12 | | -xfail = pytest.mark.xfail |
13 | 11 | driver_path = adbc_driver_duckdb.driver_path() |
14 | 12 |
|
15 | 13 |
|
| 14 | +xfail = pytest.mark.xfail |
| 15 | + |
| 16 | + |
16 | 17 | @pytest.fixture |
17 | 18 | def duck_conn(): |
| 19 | + adbc_driver_manager = pytest.importorskip("adbc_driver_manager") |
| 20 | + |
18 | 21 | with adbc_driver_manager.dbapi.connect(driver=driver_path, entrypoint="duckdb_adbc_init") as conn: |
19 | 22 | yield conn |
20 | 23 |
|
@@ -95,6 +98,8 @@ def test_connection_get_objects_filters(duck_conn): |
95 | 98 |
|
96 | 99 |
|
97 | 100 | def test_commit(tmp_path): |
| 101 | + adbc_driver_manager = pytest.importorskip("adbc_driver_manager") |
| 102 | + |
98 | 103 | db = Path(tmp_path) / "tmp.db" |
99 | 104 | if db.exists(): |
100 | 105 | db.unlink() |
@@ -142,6 +147,8 @@ def test_commit(tmp_path): |
142 | 147 |
|
143 | 148 |
|
144 | 149 | def test_connection_get_table_schema(duck_conn): |
| 150 | + adbc_driver_manager = pytest.importorskip("adbc_driver_manager") |
| 151 | + |
145 | 152 | with duck_conn.cursor() as cursor: |
146 | 153 | # Test Default Schema |
147 | 154 | cursor.execute("CREATE TABLE tableschema (ints BIGINT)") |
@@ -209,6 +216,8 @@ def test_statement_query(duck_conn): |
209 | 216 |
|
210 | 217 | @xfail(sys.platform == "win32", reason="adbc-driver-manager returns an invalid table schema on windows") |
211 | 218 | def test_insertion(duck_conn): |
| 219 | + adbc_driver_manager = pytest.importorskip("adbc_driver_manager") |
| 220 | + |
212 | 221 | table = example_table() |
213 | 222 | reader = table.to_reader() |
214 | 223 |
|
@@ -281,6 +290,8 @@ def test_read(duck_conn): |
281 | 290 |
|
282 | 291 |
|
283 | 292 | def test_large_chunk(tmp_path): |
| 293 | + adbc_driver_manager = pytest.importorskip("adbc_driver_manager") |
| 294 | + |
284 | 295 | num_chunks = 3 |
285 | 296 | chunk_size = 10_000 |
286 | 297 |
|
@@ -318,6 +329,8 @@ def test_large_chunk(tmp_path): |
318 | 329 |
|
319 | 330 |
|
320 | 331 | def test_dictionary_data(tmp_path): |
| 332 | + adbc_driver_manager = pytest.importorskip("adbc_driver_manager") |
| 333 | + |
321 | 334 | data = ["apple", "banana", "apple", "orange", "banana", "banana"] |
322 | 335 |
|
323 | 336 | dict_type = pyarrow.dictionary(index_type=pyarrow.int32(), value_type=pyarrow.string()) |
@@ -346,6 +359,8 @@ def test_dictionary_data(tmp_path): |
346 | 359 |
|
347 | 360 |
|
348 | 361 | def test_ree_data(tmp_path): |
| 362 | + adbc_driver_manager = pytest.importorskip("adbc_driver_manager") |
| 363 | + |
349 | 364 | run_ends = pyarrow.array([3, 5, 6], type=pyarrow.int32()) # positions: [0-2], [3-4], [5] |
350 | 365 | values = pyarrow.array(["apple", "banana", "orange"], type=pyarrow.string()) |
351 | 366 |
|
|
0 commit comments