Skip to content

Commit

Permalink
Merge pull request #836 from dbt-labs/split-up-test-dataflow-to-sql
Browse files Browse the repository at this point in the history
Split up test_dataflow_to_sql_plan module into more manageable components
  • Loading branch information
tlento authored Nov 3, 2023
2 parents 7bbb704 + 4a24730 commit 6f6de91
Show file tree
Hide file tree
Showing 215 changed files with 692 additions and 23,129 deletions.
13 changes: 13 additions & 0 deletions metricflow/test/fixtures/sql_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@

import pytest

from metricflow.model.semantic_manifest_lookup import SemanticManifestLookup
from metricflow.plan_conversion.column_resolver import DunderColumnAssociationResolver
from metricflow.plan_conversion.dataflow_to_sql import DataflowToSqlQueryPlanConverter
from metricflow.sql.render.sql_plan_renderer import DefaultSqlQueryPlanRenderer, SqlQueryPlanRenderer


@pytest.fixture
def default_sql_plan_renderer() -> SqlQueryPlanRenderer: # noqa: D
return DefaultSqlQueryPlanRenderer()


@pytest.fixture(scope="session")
def dataflow_to_sql_converter( # noqa: D
simple_semantic_manifest_lookup: SemanticManifestLookup,
) -> DataflowToSqlQueryPlanConverter:
return DataflowToSqlQueryPlanConverter(
column_association_resolver=DunderColumnAssociationResolver(simple_semantic_manifest_lookup),
semantic_manifest_lookup=simple_semantic_manifest_lookup,
)
4 changes: 2 additions & 2 deletions metricflow/test/generate_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def run_tests(test_configuration: MetricFlowTestConfiguration) -> None: # noqa:
os.environ["MF_SQL_ENGINE_PASSWORD"] = test_configuration.credential_set.engine_password

if test_configuration.engine is SqlEngine.DUCKDB:
# Can't use --use-persistent-source-schema with duckdb since it's in memory.
run_command(f"pytest -x -vv -n 4 --overwrite-snapshots -m '{SQL_ENGINE_SNAPSHOT_MARKER_NAME}' {TEST_DIRECTORY}")
# DuckDB is fast, so generate all snapshots, including the engine-agnostic ones
run_command(f"pytest -x -vv -n 4 --overwrite-snapshots -k 'not itest' {TEST_DIRECTORY}")
elif (
test_configuration.engine is SqlEngine.REDSHIFT
or test_configuration.engine is SqlEngine.SNOWFLAKE
Expand Down
17 changes: 0 additions & 17 deletions metricflow/test/plan_conversion/conftest.py

This file was deleted.

Loading

0 comments on commit 6f6de91

Please sign in to comment.