-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
beginning to reorg the functional tests
- Loading branch information
Showing
15 changed files
with
149 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# macros # | ||
MACROS__CAST_SQL = """ | ||
{% macro string_literal(s) -%} | ||
{{ adapter.dispatch('string_literal', macro_namespace='test')(s) }} | ||
{%- endmacro %} | ||
{% macro databricks__string_literal(s) %} | ||
cast('{{ s }}' as STRING) | ||
{% endmacro %} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from dbt.tests.adapter.aliases.test_aliases import ( | ||
BaseAliases, | ||
BaseAliasErrors, | ||
BaseSameAliasDifferentSchemas, | ||
BaseSameAliasDifferentDatabases, | ||
) | ||
from dbt.tests.adapter.aliases import fixtures as dbt_fixtures | ||
import pytest | ||
|
||
from tests.functional.adapter.aliases import fixtures as databricks_fixtures | ||
|
||
|
||
macro_override = { | ||
"cast.sql": databricks_fixtures.MACROS__CAST_SQL, | ||
"expect_value.sql": dbt_fixtures.MACROS__EXPECT_VALUE_SQL, | ||
} | ||
|
||
|
||
class TestDatabricksAliases(BaseAliases): | ||
@pytest.fixture(scope="class") | ||
def macros(self): | ||
return macro_override | ||
|
||
|
||
class TestDatabricksAliasErrors(BaseAliasErrors): | ||
@pytest.fixture(scope="class") | ||
def macros(self): | ||
return macro_override | ||
|
||
|
||
class TestDatabricksSameAliasDifferentSchemas(BaseSameAliasDifferentSchemas): | ||
@pytest.fixture(scope="class") | ||
def macros(self): | ||
return macro_override | ||
|
||
|
||
class TestDatabricksSameAliasDifferentDatabases(BaseSameAliasDifferentDatabases): | ||
@pytest.fixture(scope="class") | ||
def macros(self): | ||
return macro_override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from dbt.tests.adapter.basic.test_base import BaseSimpleMaterializations | ||
|
||
|
||
class TestDatabricksSimpleMaterializations(BaseSimpleMaterializations): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from dbt.tests.adapter.basic.test_empty import BaseEmpty | ||
|
||
|
||
class TestDatabricksEmpty(BaseEmpty): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from dbt.tests.adapter.basic.test_ephemeral import BaseEphemeral | ||
|
||
|
||
class TestDatabricksEphemeral(BaseEphemeral): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from dbt.tests.adapter.basic.test_generic_tests import BaseGenericTests | ||
|
||
|
||
class TestDatabricksGenericTests(BaseGenericTests): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from dbt.tests.adapter.basic.test_incremental import BaseIncremental, BaseIncrementalNotSchemaChange | ||
|
||
|
||
class TestDatabricksIncremental(BaseIncremental): | ||
pass | ||
|
||
|
||
class TestDatabricksIncrementalNotSchemaChange(BaseIncrementalNotSchemaChange): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from dbt.tests.adapter.basic.test_singular_tests import BaseSingularTests | ||
|
||
|
||
class TestDatabricksSingularTests(BaseSingularTests): | ||
pass |
5 changes: 5 additions & 0 deletions
5
tests/functional/adapter/basic/test_singular_tests_ephemeral.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from dbt.tests.adapter.basic.test_singular_tests_ephemeral import BaseSingularTestsEphemeral | ||
|
||
|
||
class TestDatabricksSingularTestsEphemeral(BaseSingularTestsEphemeral): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from dbt.tests.adapter.basic.test_snapshot_check_cols import BaseSnapshotCheckCols | ||
|
||
|
||
class TestDatabricksSnapshotCheckCols(BaseSnapshotCheckCols): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from dbt.tests.adapter.basic.test_snapshot_timestamp import BaseSnapshotTimestamp | ||
|
||
|
||
class TestDatabricksSnapshotTimestamp(BaseSnapshotTimestamp): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from dbt.tests.util import AnyInteger | ||
|
||
|
||
class StatsLikeDict: | ||
"""Any stats-like dict. Use this in assert calls""" | ||
|
||
def __eq__(self, other): | ||
return ( | ||
isinstance(other, dict) | ||
and "has_stats" in other | ||
and ( | ||
other["has_stats"] | ||
== { | ||
"id": "has_stats", | ||
"label": "Has Stats?", | ||
"value": AnyInteger(), | ||
"description": "Indicates whether there are statistics for this table", | ||
"include": False, | ||
} | ||
) | ||
) | ||
|
||
|
||
class AnyLongType: | ||
"""Allows bigint and long to be treated equivalently""" | ||
|
||
def __eq__(self, other): | ||
return isinstance(other, str) and other in ("bigint", "long") |
13 changes: 13 additions & 0 deletions
13
tests/functional/adapter/ephemeral/test_ephemeral_multi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from dbt.tests.adapter.ephemeral.test_ephemeral import BaseEphemeralMulti | ||
from dbt.tests import util | ||
|
||
|
||
class TestDatabricksEphemeralMulti(BaseEphemeralMulti): | ||
def test_ephemeral_multi(self, project): | ||
util.run_dbt(["seed"]) | ||
results = util.run_dbt(["run"]) | ||
assert len(results) == 3 | ||
|
||
util.check_relations_equal(project.adapter, ["seed", "dependent"]) | ||
util.check_relations_equal(project.adapter, ["seed", "double_dependent"]) | ||
util.check_relations_equal(project.adapter, ["seed", "super_dependent"]) |
This file was deleted.
Oops, something went wrong.