-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reorganize fixtures and implement a happy path test for semantic_manifest #9930
Changes from 2 commits
b96cdcf
55f73ae
46712cc
46edee7
e4c52b1
e82c2c5
3cdd4fb
bccee25
661f45c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ class NodeRelation(dbtClassMixin): | |
alias: str | ||
schema_name: str # TODO: Could this be called simply "schema" so we could reuse StateRelation? | ||
database: Optional[str] = None | ||
relation_name: Optional[str] = None | ||
relation_name: Optional[str] = "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR is focused on tests and fixtures for tests. Was the default value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So after this got fixed we started seeing test failures that take the form of
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test that failed, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like the protocol for NodeRelation does have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha yes, maybe this does deserve a separate PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updating the default value of |
||
|
||
|
||
# ==================================== | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import pytest | ||
from dbt.contracts.graph.semantic_manifest import SemanticManifest | ||
|
||
# Request fixtures for manifest, this is simialr to import * in the file. | ||
pytest_plugins = ("tests.unit.utils.manifest",) | ||
|
||
# Overwrite the default nods to construct the manifest | ||
|
||
|
||
@pytest.fixture | ||
def nodes(metricflow_time_spine_model): | ||
return [metricflow_time_spine_model] | ||
|
||
|
||
@pytest.fixture | ||
def semantic_models( | ||
semantic_model, | ||
) -> list: | ||
return [semantic_model] | ||
|
||
|
||
@pytest.fixture | ||
def metrics( | ||
metric, | ||
) -> list: | ||
return [metric] | ||
|
||
|
||
class TestSemanticManifest: | ||
def test_validate(self, manifest): | ||
sm_manifest = SemanticManifest(manifest) | ||
assert sm_manifest.validate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we using this field anywhere?
If not, might be OK to drop similar to #9794
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will look up but @QMalcolm if you know anything about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used in a couple places in Metricflow:
Thus it is important for us to power it, and we should not drop it.