Skip to content

Commit c628df9

Browse files
Gabe PescoGabe Pesco
authored andcommitted
style: apply ruff-format and fix stray test assertions
Run ruff-format on changed files. Remove DuckDB attach assertions accidentally included in test_config_ownership_defaults_to_empty — those are already covered by test_load_duckdb_attach_config. Signed-off-by: Gabe Pesco <gabe.pesco@milliman.com> Signed-off-by: Gabe Pesco <PescoG@medinsight.milliman.com>
1 parent 671f762 commit c628df9

4 files changed

Lines changed: 4 additions & 26 deletions

File tree

sqlmesh/core/config/ownership.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
if t.TYPE_CHECKING:
1212
OwnershipMapping = t.Dict[re.Pattern, str]
1313
else:
14-
OwnershipMapping = t.Annotated[
15-
t.Dict[re.Pattern, str], BeforeValidator(compile_regex_mapping)
16-
]
14+
OwnershipMapping = t.Annotated[t.Dict[re.Pattern, str], BeforeValidator(compile_regex_mapping)]
1715

1816

1917
class OwnershipConfig(BaseConfig):

tests/core/engine_adapter/test_spark.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,9 +1095,7 @@ def test_table_format(adapter: SparkEngineAdapter, mocker: MockerFixture):
10951095
def test_alter_schema_owner(make_mocked_engine_adapter: t.Callable):
10961096
adapter = make_mocked_engine_adapter(SparkEngineAdapter)
10971097
adapter.alter_schema_owner("catalog.my_schema", "svc_prod_spn")
1098-
assert to_sql_calls(adapter) == [
1099-
"ALTER SCHEMA `catalog`.`my_schema` OWNER TO `svc_prod_spn`"
1100-
]
1098+
assert to_sql_calls(adapter) == ["ALTER SCHEMA `catalog`.`my_schema` OWNER TO `svc_prod_spn`"]
11011099

11021100

11031101
def test_alter_schema_owner_three_part_name(make_mocked_engine_adapter: t.Callable):

tests/core/test_config.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -698,20 +698,6 @@ def test_config_ownership_defaults_to_empty():
698698
assert config.ownership.environment_owner_mapping == {}
699699
assert config.ownership.resolve_owner("prod") is None
700700

701-
attach_config_1 = config.gateways["another_gateway"].connection.catalogs.get("sqlite")
702-
703-
assert isinstance(attach_config_1, DuckDBAttachOptions)
704-
assert attach_config_1.type == "sqlite"
705-
assert attach_config_1.path == "test.db"
706-
assert attach_config_1.read_only is False
707-
708-
attach_config_2 = config.gateways["another_gateway"].connection.catalogs.get("postgres")
709-
710-
assert isinstance(attach_config_2, DuckDBAttachOptions)
711-
assert attach_config_2.type == "postgres"
712-
assert attach_config_2.path == "dbname=postgres user=postgres host=127.0.0.1"
713-
assert attach_config_2.read_only is True
714-
715701

716702
def test_ownership_config_physical_owner():
717703
# physical_owner is a simple optional string — no pattern matching.

tests/core/test_snapshot_evaluator.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,7 @@ def test_promote_owner_applied_per_view(mocker: MockerFixture, adapter_mock, mak
495495
snapshot.categorize_as(SnapshotChangeCategory.BREAKING)
496496
snapshots.append(snapshot)
497497

498-
evaluator.promote(
499-
snapshots, EnvironmentNamingInfo(name="test_env"), owner="svc_prod_spn"
500-
)
498+
evaluator.promote(snapshots, EnvironmentNamingInfo(name="test_env"), owner="svc_prod_spn")
501499

502500
assert adapter_mock.alter_view_owner.call_count == 3
503501
called_owners = {c.args[1] for c in adapter_mock.alter_view_owner.call_args_list}
@@ -546,9 +544,7 @@ def test_create_without_physical_owner_skips_alter(
546544
adapter_mock.alter_table_owner.assert_not_called()
547545

548546

549-
def test_create_view_kind_skips_physical_owner(
550-
mocker: MockerFixture, adapter_mock, make_snapshot
551-
):
547+
def test_create_view_kind_skips_physical_owner(mocker: MockerFixture, adapter_mock, make_snapshot):
552548
"""ViewKind snapshots skip alter_table_owner even when physical_owner is set."""
553549
adapter_mock.get_data_objects.return_value = []
554550
evaluator = SnapshotEvaluator(adapter_mock)

0 commit comments

Comments
 (0)