|
1 | | -import duckdb |
2 | | -import os |
3 | | -import psycopg2 |
4 | | -import psycopg2.extras |
5 | | -import pytest |
6 | | -import shutil |
7 | | -import queue |
8 | | -import threading |
9 | | -import time |
10 | | -from utils_pytest import * |
11 | | -import server_params |
12 | | - |
13 | | -reduce_werkzeug_log_level() |
14 | | - |
15 | | - |
16 | | -@pytest.fixture(scope="module") |
17 | | -def pgduck_conn(postgres): |
18 | | - conn = psycopg2.connect( |
19 | | - host=server_params.PGDUCK_UNIX_DOMAIN_PATH, port=server_params.PGDUCK_PORT |
20 | | - ) |
21 | | - yield conn |
22 | | - conn.close() |
23 | | - |
24 | | - |
25 | | -@pytest.fixture(scope="module") |
26 | | -def test_s3_path(request, s3): |
27 | | - return f"s3://{TEST_BUCKET}/{request.node.name}" |
28 | | - |
29 | | - |
30 | | -@pytest.fixture(scope="module") |
31 | | -def iceberg_catalog(superuser_conn, iceberg_extension, s3): |
32 | | - catalog = create_iceberg_test_catalog(superuser_conn) |
33 | | - yield catalog |
34 | | - tables = catalog.list_tables("public") |
35 | | - for table in tables: |
36 | | - catalog.drop_table(table) |
37 | | - catalog.drop_namespace("public") |
38 | | - catalog.engine.dispose() |
39 | | - |
40 | | - |
41 | | -@pytest.fixture(scope="module") |
42 | | -def duckdb_conn(s3): |
43 | | - conn = duckdb.connect(database=":memory:") |
44 | | - conn.execute( |
45 | | - """ |
46 | | - CREATE SECRET s3test ( |
47 | | - TYPE S3, KEY_ID 'testing', SECRET 'testing', |
48 | | - ENDPOINT 'localhost:5999', |
49 | | - SCOPE 's3://testbucketcdw', URL_STYLE 'path', USE_SSL false |
50 | | - ); |
51 | | - """ |
52 | | - ) |
53 | | - conn.execute( |
54 | | - """ |
55 | | - CREATE SECRET gcstest ( |
56 | | - TYPE GCS, KEY_ID 'testing', SECRET 'testing', |
57 | | - ENDPOINT 'localhost:5998', |
58 | | - SCOPE 'gs://testbucketgcs', URL_STYLE 'path', USE_SSL false |
59 | | - ); |
60 | | - """ |
61 | | - ) |
62 | | - yield conn |
63 | | - conn.close() |
| 1 | +from utils_pytest import pytest_addoption, pytest_sessionstart |
0 commit comments