Skip to content

Commit b973289

Browse files
committed
Format
1 parent 29660e8 commit b973289

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/databricks/labs/ucx/hive_metastore/catalog_schema.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ def _get_database_source_target_mapping(self) -> dict[str, list[SchemaInfo]]:
129129
src_trg_schema_mapping[table_mapping.src_schema].append(schema)
130130
return src_trg_schema_mapping
131131

132-
def _create_catalog_validate(self, catalog_name: str, prompts: Prompts, *, properties: dict[str, str] | None) -> None:
132+
def _create_catalog_validate(
133+
self, catalog_name: str, prompts: Prompts, *, properties: dict[str, str] | None
134+
) -> None:
133135
try:
134136
catalog = self._ws.catalogs.get(catalog_name)
135137
except NotFound:

tests/unit/hive_metastore/test_catalog_schema.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616

1717
def prepare_test(ws, backend: MockBackend | None = None) -> CatalogSchema:
1818
ws.catalogs.list.return_value = [CatalogInfo(name="catalog1")]
19+
1920
def get_catalog(catalog_name: str) -> CatalogInfo | None:
2021
if catalog_name == "catalog1":
2122
return CatalogInfo(name="catalog1")
2223
return None
24+
2325
ws.catalogs.get.side_effect = get_catalog
2426

2527
def raise_catalog_exists(catalog: str, *_, **__) -> None:
@@ -155,7 +157,15 @@ def raise_catalog_exists(catalog: str, *_, **__) -> None:
155157
assert "Skipping already existing catalog: ucx" in caplog.text
156158

157159

158-
@pytest.mark.parametrize("location", ["s3://foo/bar", "s3://foo/bar/test", "s3://foo/bar/test/baz", "abfss://container@storageaccount.dfs.core.windows.net"])
160+
@pytest.mark.parametrize(
161+
"location",
162+
[
163+
"s3://foo/bar",
164+
"s3://foo/bar/test",
165+
"s3://foo/bar/test/baz",
166+
"abfss://container@storageaccount.dfs.core.windows.net",
167+
],
168+
)
159169
def test_create_all_catalogs_schemas_creates_catalogs(location: str) -> None:
160170
"""Catalog 2-4 should be created; catalog 1 already exists."""
161171
ws = create_autospec(WorkspaceClient)
@@ -175,11 +185,13 @@ def test_create_all_catalogs_schemas_creates_catalogs(location: str) -> None:
175185
def test_create_all_catalogs_schemas_creates_catalogs_with_different_locations() -> None:
176186
"""Catalog 2-4 should be created; catalog 1 already exists."""
177187
ws = create_autospec(WorkspaceClient)
178-
mock_prompts = MockPrompts({
179-
"Please provide storage location url for catalog: catalog2": "s3://foo/bar",
180-
"Please provide storage location url for catalog: catalog3": "s3://foo/bar/test",
181-
"Please provide storage location url for catalog: catalog4": "s3://foo/bar/test/baz",
182-
})
188+
mock_prompts = MockPrompts(
189+
{
190+
"Please provide storage location url for catalog: catalog2": "s3://foo/bar",
191+
"Please provide storage location url for catalog: catalog3": "s3://foo/bar/test",
192+
"Please provide storage location url for catalog: catalog4": "s3://foo/bar/test/baz",
193+
}
194+
)
183195

184196
catalog_schema = prepare_test(ws)
185197
catalog_schema.create_all_catalogs_schemas(mock_prompts)

0 commit comments

Comments
 (0)