Skip to content

Commit

Permalink
Skip / comment out tests for metrics functionality that we'll be impl…
Browse files Browse the repository at this point in the history
…ementing later
  • Loading branch information
QMalcolm committed Jun 7, 2023
1 parent 94b2589 commit 0ed5c91
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions tests/functional/metrics/test_metric_deferral.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def models(self):
"metrics.yml": metrics_1_yml,
}

@pytest.mark.skip("TODO")
def test_metric_deferral(self, project):
results = run_dbt(["run", "--target", "prod"])
assert len(results) == 2
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/metrics/test_metric_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ def models(self):
"people.sql": models_people_sql,
}

@pytest.mark.skip(
"TODO reactivate after we begin property hydrating metric `depends_on` and `refs`"
)
def test_expression_metric(
self,
project,
Expand Down
1 change: 1 addition & 0 deletions tests/functional/metrics/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def seeds(self):
"mock_purchase_data.csv": mock_purchase_data_csv,
}

@pytest.mark.skip("TODO bring back once we start populating metric `depends_on`")
def test_derived_metric(
self,
project,
Expand Down
33 changes: 18 additions & 15 deletions tests/functional/partial_parsing/test_pp_metrics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest

from dbt.contracts.graph.nodes import RefArgs
from dbt.tests.util import run_dbt, write_file, get_manifest
from tests.functional.partial_parsing.fixtures import (
people_sql,
Expand Down Expand Up @@ -34,15 +33,17 @@ def test_metrics(self, project):
manifest = get_manifest(project.project_root)
assert len(manifest.metrics) == 2
metric_people_id = "metric.test.number_of_people"
metric_tenure_id = "metric.test.collective_tenure"
metric_people = manifest.metrics[metric_people_id]
metric_tenure = manifest.metrics[metric_tenure_id]
expected_meta = {"my_meta": "testing"}
assert metric_people.meta == expected_meta
assert metric_people.refs == [RefArgs(name="people")]
assert metric_tenure.refs == [RefArgs(name="people")]
expected_depends_on_nodes = ["model.test.people"]
assert metric_people.depends_on.nodes == expected_depends_on_nodes

# TODO: Bring back when we resolving `depends_on_nodes`
# metric_tenure_id = "metric.test.collective_tenure"
# metric_tenure = manifest.metrics[metric_tenure_id]
# assert metric_people.refs == [RefArgs(name="people")]
# assert metric_tenure.refs == [RefArgs(name="people")]
# expected_depends_on_nodes = ["model.test.people"]
# assert metric_people.depends_on.nodes == expected_depends_on_nodes

# Change metrics yaml files
write_file(people_metrics2_yml, project.project_root, "models", "people_metrics.yml")
Expand All @@ -52,19 +53,21 @@ def test_metrics(self, project):
metric_people = manifest.metrics[metric_people_id]
expected_meta = {"my_meta": "replaced"}
assert metric_people.meta == expected_meta
expected_depends_on_nodes = ["model.test.people"]
assert metric_people.depends_on.nodes == expected_depends_on_nodes
# TODO: Bring back when we resolving `depends_on_nodes`
# expected_depends_on_nodes = ["model.test.people"]
# assert metric_people.depends_on.nodes == expected_depends_on_nodes

# Add model referring to metric
write_file(metric_model_a_sql, project.project_root, "models", "metric_model_a.sql")
results = run_dbt(["run"])
manifest = get_manifest(project.project_root)
model_a = manifest.nodes["model.test.metric_model_a"]
expected_depends_on_nodes = [
"metric.test.number_of_people",
"metric.test.collective_tenure",
]
assert model_a.depends_on.nodes == expected_depends_on_nodes
# TODO: Bring back when we resolving `depends_on_nodes`
# model_a = manifest.nodes["model.test.metric_model_a"]
# expected_depends_on_nodes = [
# "metric.test.number_of_people",
# "metric.test.collective_tenure",
# ]
# assert model_a.depends_on.nodes == expected_depends_on_nodes

# Then delete a metric
write_file(people_metrics3_yml, project.project_root, "models", "people_metrics.yml")
Expand Down

0 comments on commit 0ed5c91

Please sign in to comment.