Skip to content

Commit

Permalink
convert adapter method test
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenyuLInx committed Apr 8, 2022
1 parent 54c8d60 commit cb3adca
Show file tree
Hide file tree
Showing 18 changed files with 16 additions and 351 deletions.
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ def dbt_profile_target(unique_schema):
}


# Every test has a unique schema
# Snowflake uses all uppercase
@pytest.fixture(scope="class")
def unique_schema(request, prefix) -> str:
test_file = request.module.__name__
# We only want the last part of the name
test_file = test_file.split(".")[-1]
unique_schema = f"{prefix}_{test_file}".upper()
return unique_schema
7 changes: 7 additions & 0 deletions tests/functional/adapter/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from dbt.tests.adapter.basic.test_generic_tests import BaseGenericTests
from dbt.tests.adapter.basic.test_snapshot_check_cols import BaseSnapshotCheckCols
from dbt.tests.adapter.basic.test_snapshot_timestamp import BaseSnapshotTimestamp
from dbt.tests.adapter.basic.test_adapter_methods import BaseAdapterMethod



class TestSimpleMaterializationsSnowflake(BaseSimpleMaterializations):
Expand Down Expand Up @@ -47,3 +49,8 @@ class TestSnapshotCheckColsSnowflake(BaseSnapshotCheckCols):

class TestSnapshotTimestampSnowflake(BaseSnapshotTimestamp):
pass

class TestBaseAdapterMethodSnowflake(BaseAdapterMethod):
@pytest.fixture(scope="class")
def equal_tables(self):
return ["MODEL", "EXPECTED"]
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
-- Macro to rename a relation
{% macro rename_named_relation(from_name, to_name) %}
{%- set from_relation = api.Relation.create(database=target.database, schema=target.schema, identifier=from_name, type='table') -%}
{%- set to_relation = api.Relation.create(database=target.database, schema=target.schema, identifier=to_name, type='table') -%}
{% do adapter.rename_relation(from_relation, to_relation) %}
{% endmacro %}
1 change: 0 additions & 1 deletion tests/integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@ def assertTablesEqual(self, table_a, table_b,

relation_a = self._make_relation(table_a, table_a_schema, table_a_db)
relation_b = self._make_relation(table_b, table_b_schema, table_b_db)

self._assertTableColumnsEqual(relation_a, relation_b)

sql = self._assertTablesEqualSql(relation_a, relation_b)
Expand Down
Empty file.

This file was deleted.

9 changes: 0 additions & 9 deletions tests/integration/graph_selection_tests/models/base_users.sql

This file was deleted.

6 changes: 0 additions & 6 deletions tests/integration/graph_selection_tests/models/emails.sql

This file was deleted.

This file was deleted.

This file was deleted.

39 changes: 0 additions & 39 deletions tests/integration/graph_selection_tests/models/schema.yml

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions tests/integration/graph_selection_tests/models/users.sql

This file was deleted.

19 changes: 0 additions & 19 deletions tests/integration/graph_selection_tests/models/users_rollup.sql

This file was deleted.

This file was deleted.

119 changes: 0 additions & 119 deletions tests/integration/graph_selection_tests/seed.sql

This file was deleted.

Loading

0 comments on commit cb3adca

Please sign in to comment.