|
47 | 47 | import pytest |
48 | 48 | from moto import mock_aws |
49 | 49 | from pydantic_core import to_json |
| 50 | +from sqlalchemy import Connection |
50 | 51 |
|
51 | 52 | from pyiceberg.catalog import Catalog, load_catalog |
52 | 53 | from pyiceberg.catalog.noop import NoopCatalog |
@@ -143,6 +144,18 @@ def pytest_addoption(parser: pytest.Parser) -> None: |
143 | 144 | "--gcs.oauth2.token", action="store", default="anon", help="The GCS authentication method for tests marked gcs" |
144 | 145 | ) |
145 | 146 | parser.addoption("--gcs.project-id", action="store", default="test", help="The GCP project for tests marked gcs") |
| 147 | + parser.addoption( |
| 148 | + "--trino.rest.endpoint", |
| 149 | + action="store", |
| 150 | + default="trino://test@localhost:8082/warehouse_rest", |
| 151 | + help="The Trino REST endpoint URL for tests marked as integration_trino", |
| 152 | + ) |
| 153 | + parser.addoption( |
| 154 | + "--trino.hive.endpoint", |
| 155 | + action="store", |
| 156 | + default="trino://test@localhost:8082/warehouse_hive", |
| 157 | + help="The Trino Hive endpoint URL for tests marked as integration_trino", |
| 158 | + ) |
146 | 159 |
|
147 | 160 |
|
148 | 161 | @pytest.fixture(scope="session") |
@@ -2574,6 +2587,28 @@ def bound_reference_uuid() -> BoundReference[str]: |
2574 | 2587 | return BoundReference(field=NestedField(1, "field", UUIDType(), required=False), accessor=Accessor(position=0, inner=None)) |
2575 | 2588 |
|
2576 | 2589 |
|
| 2590 | +@pytest.fixture(scope="session") |
| 2591 | +def trino_hive_conn(request: pytest.FixtureRequest) -> Generator[Connection, None, None]: |
| 2592 | + from sqlalchemy import create_engine |
| 2593 | + |
| 2594 | + trino_endpoint = request.config.getoption("--trino.hive.endpoint") |
| 2595 | + engine = create_engine(trino_endpoint) |
| 2596 | + connection = engine.connect() |
| 2597 | + yield connection |
| 2598 | + connection.close() |
| 2599 | + |
| 2600 | + |
| 2601 | +@pytest.fixture(scope="session") |
| 2602 | +def trino_rest_conn(request: pytest.FixtureRequest) -> Generator[Connection, None, None]: |
| 2603 | + from sqlalchemy import create_engine |
| 2604 | + |
| 2605 | + trino_endpoint = request.config.getoption("--trino.rest.endpoint") |
| 2606 | + engine = create_engine(trino_endpoint) |
| 2607 | + connection = engine.connect() |
| 2608 | + yield connection |
| 2609 | + connection.close() |
| 2610 | + |
| 2611 | + |
2577 | 2612 | @pytest.fixture(scope="session") |
2578 | 2613 | def session_catalog() -> Catalog: |
2579 | 2614 | return load_catalog( |
|
0 commit comments