Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Jan 31, 2024
1 parent 7d962ed commit 01fad88
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 46 deletions.
33 changes: 15 additions & 18 deletions tests/functional/artifacts/expected_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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_"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down
3 changes: 0 additions & 3 deletions tests/functional/defer_state/test_defer_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/sources/test_source_fresher_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions tests/unit/test_contracts_graph_compiled.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def basic_uncompiled_model():
sources=[],
metrics=[],
depends_on=DependsOn(),
deferred=False,
description="",
database="test_db",
schema="test_schema",
Expand Down Expand Up @@ -71,7 +70,6 @@ def basic_compiled_model():
sources=[],
metrics=[],
depends_on=DependsOn(),
deferred=True,
description="",
database="test_db",
schema="test_schema",
Expand Down Expand Up @@ -132,7 +130,6 @@ def basic_uncompiled_dict():
"metrics": [],
"depends_on": {"macros": [], "nodes": []},
"database": "test_db",
"deferred": False,
"description": "",
"schema": "test_schema",
"alias": "bar",
Expand Down Expand Up @@ -185,7 +182,6 @@ def basic_compiled_dict():
"metrics": [],
"depends_on": {"macros": [], "nodes": []},
"database": "test_db",
"deferred": True,
"description": "",
"schema": "test_schema",
"alias": "bar",
Expand Down Expand Up @@ -409,7 +405,6 @@ def basic_uncompiled_schema_test_node():
refs=[],
sources=[],
metrics=[],
deferred=False,
depends_on=DependsOn(),
description="",
database="test_db",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -498,7 +492,6 @@ def basic_uncompiled_schema_test_dict():
"fail_calc": "count(*)",
"meta": {},
},
"deferred": False,
"docs": {"show": True},
"columns": {},
"meta": {},
Expand Down Expand Up @@ -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",
Expand Down
15 changes: 0 additions & 15 deletions tests/unit/test_contracts_graph_parsed.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def base_parsed_model_dict():
"packages": [],
"access": "protected",
},
"deferred": False,
"docs": {"show": True},
"contract": {"enforced": False, "alias_types": True},
"columns": {},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -518,7 +515,6 @@ def basic_parsed_seed_dict():
"contract": {"enforced": False, "alias_types": True},
"packages": [],
},
"deferred": False,
"docs": {"show": True},
"columns": {},
"meta": {},
Expand Down Expand Up @@ -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={},
Expand Down Expand Up @@ -611,7 +606,6 @@ def complex_parsed_seed_dict():
"contract": {"enforced": False, "alias_types": True},
"packages": [],
},
"deferred": False,
"docs": {"show": True},
"columns": {
"a": {
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -848,7 +840,6 @@ def base_parsed_hook_object():
metrics=[],
depends_on=DependsOn(),
description="",
deferred=False,
database="test_db",
schema="test_schema",
alias="bar",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1489,7 +1476,6 @@ def basic_timestamp_snapshot_dict():
"sources": [],
"metrics": [],
"depends_on": {"macros": [], "nodes": []},
"deferred": False,
"database": "test_db",
"description": "",
"schema": "test_schema",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"compiled_path",
"patch_path",
"docs",
"deferred",
"checksum",
"unrendered_config",
"created_at",
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 01fad88

Please sign in to comment.