From 01fad88d99562dd257f8f081610a1e37cdc49a5b Mon Sep 17 00:00:00 2001 From: Jeremy Cohen Date: Mon, 4 Dec 2023 05:36:22 +0100 Subject: [PATCH] Fix failing tests --- .../functional/artifacts/expected_manifest.py | 33 +++++++++---------- .../defer_state/test_defer_state.py | 3 -- .../sources/test_source_fresher_state.py | 2 +- tests/unit/test_contracts_graph_compiled.py | 8 ----- tests/unit/test_contracts_graph_parsed.py | 15 --------- tests/unit/test_manifest.py | 1 - tests/unit/test_providers.py | 1 + 7 files changed, 17 insertions(+), 46 deletions(-) diff --git a/tests/functional/artifacts/expected_manifest.py b/tests/functional/artifacts/expected_manifest.py index 69577b65a6b..21a24866cb9 100644 --- a/tests/functional/artifacts/expected_manifest.py +++ b/tests/functional/artifacts/expected_manifest.py @@ -279,7 +279,7 @@ def expected_seeded_manifest(project, model_database=None, quote_model=False): "group": None, "schema": my_schema_name, "database": model_database, - "deferred": False, + "defer_relation": None, "alias": "model", "description": "The test model", "columns": { @@ -372,7 +372,7 @@ def expected_seeded_manifest(project, model_database=None, quote_model=False): "group": None, "schema": alternate_schema, "database": project.database, - "deferred": False, + "defer_relation": None, "alias": "second_model", "description": "The second test model", "columns": { @@ -457,7 +457,7 @@ def expected_seeded_manifest(project, model_database=None, quote_model=False): "schema": my_schema_name, "database": project.database, "alias": "seed", - "deferred": False, + "defer_relation": None, "description": "The test seed", "columns": { "id": { @@ -530,7 +530,6 @@ def expected_seeded_manifest(project, model_database=None, quote_model=False): "macros": ["macro.dbt.test_not_null", "macro.dbt.get_where_subquery"], "nodes": ["model.test.model"], }, - "deferred": False, "description": "", "file_key_name": "models.model", "fqn": ["test", "not_null_model_id"], @@ -580,7 +579,7 @@ def expected_seeded_manifest(project, model_database=None, quote_model=False): "contract": {"checksum": None, "enforced": False, "alias_types": True}, "database": project.database, "group": None, - "deferred": False, + "defer_relation": None, "depends_on": { "macros": [], "nodes": ["seed.test.seed"], @@ -632,7 +631,7 @@ def expected_seeded_manifest(project, model_database=None, quote_model=False): "macros": ["macro.test.test_nothing", "macro.dbt.get_where_subquery"], "nodes": ["model.test.model"], }, - "deferred": False, + "defer_relation": None, "description": "", "file_key_name": "models.model", "fqn": ["test", "test_nothing_model_"], @@ -685,7 +684,6 @@ def expected_seeded_manifest(project, model_database=None, quote_model=False): "macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.test.model"], }, - "deferred": False, "description": "", "file_key_name": "models.model", "fqn": ["test", "unique_model_id"], @@ -929,7 +927,7 @@ def expected_references_manifest(project): "nodes": ["source.test.my_source.my_table"], }, "deprecation_date": None, - "deferred": False, + "defer_relation": None, "description": "", "docs": {"node_color": None, "show": True}, "fqn": ["test", "ephemeral_copy"], @@ -995,7 +993,7 @@ def expected_references_manifest(project): "nodes": ["model.test.ephemeral_copy"], }, "deprecation_date": None, - "deferred": False, + "defer_relation": None, "description": "A summmary table of the ephemeral copy of the seed data", "docs": {"node_color": None, "show": True}, "fqn": ["test", "ephemeral_summary"], @@ -1064,7 +1062,7 @@ def expected_references_manifest(project): "nodes": ["model.test.ephemeral_summary"], }, "deprecation_date": None, - "deferred": False, + "defer_relation": None, "description": "A view of the summary of the ephemeral copy of the seed data", "docs": {"node_color": None, "show": True}, "fqn": ["test", "view_summary"], @@ -1148,7 +1146,7 @@ def expected_references_manifest(project): }, }, "config": get_rendered_seed_config(), - "deferred": False, + "defer_relation": None, "depends_on": {"macros": []}, "description": "The test seed", "docs": {"node_color": None, "show": True}, @@ -1183,7 +1181,7 @@ def expected_references_manifest(project): "config": get_rendered_snapshot_config(target_schema=alternate_schema), "contract": {"checksum": None, "enforced": False, "alias_types": True}, "database": model_database, - "deferred": False, + "defer_relation": None, "depends_on": {"macros": [], "nodes": ["seed.test.seed"]}, "description": "", "docs": {"node_color": None, "show": True}, @@ -1512,7 +1510,7 @@ def expected_versions_manifest(project): "constraints": [], "sources": [], "depends_on": {"macros": [], "nodes": []}, - "deferred": False, + "defer_relation": None, "description": "A versioned model", "deprecation_date": ANY, "docs": {"node_color": None, "show": True}, @@ -1583,7 +1581,7 @@ def expected_versions_manifest(project): "contract": {"checksum": None, "enforced": False, "alias_types": True}, "sources": [], "depends_on": {"macros": [], "nodes": []}, - "deferred": False, + "defer_relation": None, "description": "A versioned model", "deprecation_date": None, "docs": {"node_color": None, "show": True}, @@ -1637,7 +1635,7 @@ def expected_versions_manifest(project): ], }, "deprecation_date": None, - "deferred": False, + "defer_relation": None, "description": "", "docs": {"node_color": None, "show": True}, "fqn": ["test", "ref_versioned_model"], @@ -1694,7 +1692,6 @@ def expected_versions_manifest(project): "macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.test.versioned_model.v1"], }, - "deferred": False, "description": "", "file_key_name": "models.versioned_model", "fqn": ["test", "unique_versioned_model_v1_first_name"], @@ -1748,7 +1745,7 @@ def expected_versions_manifest(project): "macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.test.versioned_model.v1"], }, - "deferred": False, + "defer_relation": None, "description": "", "file_key_name": "models.versioned_model", "fqn": ["test", "unique_versioned_model_v1_count"], @@ -1802,7 +1799,7 @@ def expected_versions_manifest(project): "macros": ["macro.dbt.test_unique", "macro.dbt.get_where_subquery"], "nodes": ["model.test.versioned_model.v2"], }, - "deferred": False, + "defer_relation": None, "description": "", "file_key_name": "models.versioned_model", "fqn": ["test", "unique_versioned_model_v2_first_name"], diff --git a/tests/functional/defer_state/test_defer_state.py b/tests/functional/defer_state/test_defer_state.py index 49db771c80b..5f2ac50620f 100644 --- a/tests/functional/defer_state/test_defer_state.py +++ b/tests/functional/defer_state/test_defer_state.py @@ -86,17 +86,14 @@ def copy_state(self, project_root): def run_and_save_state(self, project_root, with_snapshot=False): results = run_dbt(["seed"]) assert len(results) == 1 - assert not any(r.node.deferred for r in results) results = run_dbt(["run"]) assert len(results) == 2 - assert not any(r.node.deferred for r in results) results = run_dbt(["test"]) assert len(results) == 2 if with_snapshot: results = run_dbt(["snapshot"]) assert len(results) == 1 - assert not any(r.node.deferred for r in results) # copy files self.copy_state(project_root) diff --git a/tests/functional/sources/test_source_fresher_state.py b/tests/functional/sources/test_source_fresher_state.py index 95c048c769f..ce61395f298 100644 --- a/tests/functional/sources/test_source_fresher_state.py +++ b/tests/functional/sources/test_source_fresher_state.py @@ -626,7 +626,7 @@ def test_intentional_failure_no_previous_state(self, project): with pytest.raises(DbtInternalError) as excinfo: self.run_dbt_with_vars( project, - ["run", "-s", "source_status:fresher", "--defer", "--state", "previous_state"], + ["run", "-s", "source_status:fresher", "--state", "previous_state"], ) assert "No previous state comparison freshness results in sources.json" in str( excinfo.value diff --git a/tests/unit/test_contracts_graph_compiled.py b/tests/unit/test_contracts_graph_compiled.py index 18b2bdea7be..591023a6ef6 100644 --- a/tests/unit/test_contracts_graph_compiled.py +++ b/tests/unit/test_contracts_graph_compiled.py @@ -39,7 +39,6 @@ def basic_uncompiled_model(): sources=[], metrics=[], depends_on=DependsOn(), - deferred=False, description="", database="test_db", schema="test_schema", @@ -71,7 +70,6 @@ def basic_compiled_model(): sources=[], metrics=[], depends_on=DependsOn(), - deferred=True, description="", database="test_db", schema="test_schema", @@ -132,7 +130,6 @@ def basic_uncompiled_dict(): "metrics": [], "depends_on": {"macros": [], "nodes": []}, "database": "test_db", - "deferred": False, "description": "", "schema": "test_schema", "alias": "bar", @@ -185,7 +182,6 @@ def basic_compiled_dict(): "metrics": [], "depends_on": {"macros": [], "nodes": []}, "database": "test_db", - "deferred": True, "description": "", "schema": "test_schema", "alias": "bar", @@ -409,7 +405,6 @@ def basic_uncompiled_schema_test_node(): refs=[], sources=[], metrics=[], - deferred=False, depends_on=DependsOn(), description="", database="test_db", @@ -443,7 +438,6 @@ def basic_compiled_schema_test_node(): sources=[], metrics=[], depends_on=DependsOn(), - deferred=False, description="", database="test_db", schema="dbt_test__audit", @@ -498,7 +492,6 @@ def basic_uncompiled_schema_test_dict(): "fail_calc": "count(*)", "meta": {}, }, - "deferred": False, "docs": {"show": True}, "columns": {}, "meta": {}, @@ -535,7 +528,6 @@ def basic_compiled_schema_test_dict(): "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, - "deferred": False, "database": "test_db", "description": "", "schema": "dbt_test__audit", diff --git a/tests/unit/test_contracts_graph_parsed.py b/tests/unit/test_contracts_graph_parsed.py index b7d01185da6..f6e2f3f8a5c 100644 --- a/tests/unit/test_contracts_graph_parsed.py +++ b/tests/unit/test_contracts_graph_parsed.py @@ -187,7 +187,6 @@ def base_parsed_model_dict(): "packages": [], "access": "protected", }, - "deferred": False, "docs": {"show": True}, "contract": {"enforced": False, "alias_types": True}, "columns": {}, @@ -273,7 +272,6 @@ def complex_parsed_model_dict(): "metrics": [], "depends_on": {"macros": [], "nodes": ["model.test.bar"]}, "database": "test_db", - "deferred": True, "description": "My parsed node", "schema": "test_schema", "alias": "bar", @@ -339,7 +337,6 @@ def complex_parsed_model_object(): sources=[], metrics=[], depends_on=DependsOn(nodes=["model.test.bar"]), - deferred=True, description="My parsed node", database="test_db", schema="test_schema", @@ -518,7 +515,6 @@ def basic_parsed_seed_dict(): "contract": {"enforced": False, "alias_types": True}, "packages": [], }, - "deferred": False, "docs": {"show": True}, "columns": {}, "meta": {}, @@ -546,7 +542,6 @@ def basic_parsed_seed_object(): alias="foo", config=SeedConfig(), # config=SeedConfig(quote_columns=True), - deferred=False, docs=Docs(show=True), columns={}, meta={}, @@ -611,7 +606,6 @@ def complex_parsed_seed_dict(): "contract": {"enforced": False, "alias_types": True}, "packages": [], }, - "deferred": False, "docs": {"show": True}, "columns": { "a": { @@ -656,7 +650,6 @@ def complex_parsed_seed_object(): delimiter=",", persist_docs={"relation": True, "columns": True}, ), - deferred=False, docs=Docs(show=True), columns={"a": ColumnInfo(name="a", description="a column description")}, meta={"foo": 1000}, @@ -796,7 +789,6 @@ def base_parsed_hook_dict(): "metrics": [], "depends_on": {"macros": [], "nodes": []}, "database": "test_db", - "deferred": False, "description": "", "schema": "test_schema", "alias": "bar", @@ -848,7 +840,6 @@ def base_parsed_hook_object(): metrics=[], depends_on=DependsOn(), description="", - deferred=False, database="test_db", schema="test_schema", alias="bar", @@ -877,7 +868,6 @@ def complex_parsed_hook_dict(): "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": ["model.test.bar"]}, - "deferred": False, "database": "test_db", "description": "My parsed node", "schema": "test_schema", @@ -942,7 +932,6 @@ def complex_parsed_hook_object(): metrics=[], depends_on=DependsOn(nodes=["model.test.bar"]), description="My parsed node", - deferred=False, database="test_db", schema="test_schema", alias="bar", @@ -1036,7 +1025,6 @@ def basic_parsed_schema_test_dict(): "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, - "deferred": False, "database": "test_db", "description": "", "schema": "test_schema", @@ -1116,7 +1104,6 @@ def complex_parsed_schema_test_dict(): "metrics": [], "depends_on": {"macros": [], "nodes": ["model.test.bar"]}, "database": "test_db", - "deferred": False, "description": "My parsed node", "schema": "test_schema", "alias": "bar", @@ -1489,7 +1476,6 @@ def basic_timestamp_snapshot_dict(): "sources": [], "metrics": [], "depends_on": {"macros": [], "nodes": []}, - "deferred": False, "database": "test_db", "description": "", "schema": "test_schema", @@ -1638,7 +1624,6 @@ def basic_check_snapshot_dict(): "metrics": [], "depends_on": {"macros": [], "nodes": []}, "database": "test_db", - "deferred": False, "description": "", "schema": "test_schema", "alias": "bar", diff --git a/tests/unit/test_manifest.py b/tests/unit/test_manifest.py index 378c2c65c7f..cf623c58284 100644 --- a/tests/unit/test_manifest.py +++ b/tests/unit/test_manifest.py @@ -83,7 +83,6 @@ "compiled_path", "patch_path", "docs", - "deferred", "checksum", "unrendered_config", "created_at", diff --git a/tests/unit/test_providers.py b/tests/unit/test_providers.py index c80de29464a..db2e3b58eba 100644 --- a/tests/unit/test_providers.py +++ b/tests/unit/test_providers.py @@ -63,6 +63,7 @@ def test_create_relation_with_empty(self, resolver, empty, is_ephemeral_model, e mock_node.quoting_dict = {} mock_node.alias = "test" mock_node.is_ephemeral_model = is_ephemeral_model + mock_node.defer_relation = None # create limited relation with mock.patch("dbt.contracts.graph.nodes.ParsedNode", new=mock.Mock):