jayceslesar commented on issue #813:
URL: https://github.com/apache/iceberg-python/issues/813#issuecomment-2972869412
@kevinjqliu what do you think about something like this...
```py
from unittest.mock import MagicMock
import pytest
from pyiceberg.catalog import Catalog
from tests.conftest import BUCKET_NAME
HIVE_CATALOG_NAME = "hive"
HIVE_METASTORE_FAKE_URL = "thrift://unknown:9083"
@pytest.fixture
def glue(_bucket_initialize: None, moto_endpoint_url: str) -> Catalog:
from pyiceberg.catalog.glue import GlueCatalog
catalog = GlueCatalog(
name="glue",
bucket_name=BUCKET_NAME,
endpoint_url=moto_endpoint_url,
)
catalog.create_namespace("foobar")
return catalog
@pytest.fixture
def hive() -> Catalog:
from pyiceberg.catalog.hive import HiveCatalog
catalog = HiveCatalog(
name="hive",
uri=HIVE_METASTORE_FAKE_URL,
)
catalog._client = MagicMock()
catalog._client.__enter__().get_all_databases.return_value = ["foobar"]
return catalog
@pytest.mark.parametrize("catalog", [
pytest.lazy_fixture("glue"),
pytest.lazy_fixture("hive")
])
def test_list_namespaces_common(catalog: Catalog) -> None:
namespaces = catalog.list_namespaces()
assert namespaces == [("foobar",)]
```
I think it becomes more of a configuration workflow than a "catalog"
workflow if that makes sense?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]