-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial code to use dbt.tests.adapter in Redshift (#81)
- Loading branch information
Showing
6 changed files
with
119 additions
and
8 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
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,10 @@ | ||
[pytest] | ||
filterwarnings = | ||
ignore:.*'soft_unicode' has been renamed to 'soft_str'*:DeprecationWarning | ||
ignore:unclosed file .*:ResourceWarning | ||
env_files = | ||
test.env | ||
testpaths = | ||
tests/unit | ||
tests/integration | ||
tests/functional |
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,22 @@ | ||
import pytest | ||
import os | ||
|
||
# Import the fuctional fixtures as a plugin | ||
# Note: fixtures with session scope need to be local | ||
|
||
pytest_plugins = ["dbt.tests.fixtures.project"] | ||
|
||
# The profile dictionary, used to write out profiles.yml | ||
@pytest.fixture(scope="class") | ||
def dbt_profile_target(): | ||
return { | ||
'type': 'redshift', | ||
'threads': 1, | ||
'host': os.getenv('REDSHIFT_TEST_HOST'), | ||
'port': int(os.getenv('REDSHIFT_TEST_PORT')), | ||
'user': os.getenv('REDSHIFT_TEST_USER'), | ||
'pass': os.getenv('REDSHIFT_TEST_PASS'), | ||
'dbname': os.getenv('REDSHIFT_TEST_DBNAME'), | ||
} | ||
|
||
|
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,79 @@ | ||
import pytest | ||
|
||
from dbt.tests.adapter.basic.test_base import BaseSimpleMaterializations | ||
from dbt.tests.adapter.basic.test_singular_tests import BaseSingularTests | ||
from dbt.tests.adapter.basic.test_singular_tests_ephemeral import ( | ||
BaseSingularTestsEphemeral, | ||
) | ||
from dbt.tests.adapter.basic.test_empty import BaseEmpty | ||
from dbt.tests.adapter.basic.test_ephemeral import BaseEphemeral | ||
from dbt.tests.adapter.basic.test_incremental import BaseIncremental | ||
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.files import seeds_base_csv, seeds_added_csv, seeds_newcolumns_csv | ||
|
||
# set the datatype of the name column in the 'added' seed so it | ||
# can hold the '_update' that's added | ||
schema_seed_added_yml = """ | ||
version: 2 | ||
seeds: | ||
- name: added | ||
config: | ||
column_types: | ||
name: varchar(64) | ||
""" | ||
|
||
|
||
class TestSimpleMaterializationsRedshift(BaseSimpleMaterializations): | ||
pass | ||
|
||
|
||
class TestSingularTestsRedshift(BaseSingularTests): | ||
pass | ||
|
||
|
||
class TestSingularTestsEphemeralRedshift(BaseSingularTestsEphemeral): | ||
pass | ||
|
||
|
||
class TestEmptyRedshift(BaseEmpty): | ||
pass | ||
|
||
|
||
class TestEphemeralRedshift(BaseEphemeral): | ||
pass | ||
|
||
|
||
class TestIncrementalRedshift(BaseIncremental): | ||
pass | ||
|
||
|
||
class TestGenericTestsRedshift(BaseGenericTests): | ||
pass | ||
|
||
|
||
class TestSnapshotCheckColsRedshift(BaseSnapshotCheckCols): | ||
# Redshift defines the 'name' column such that it's not big enough | ||
# to hold the '_update' added in the test. | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"base.csv": seeds_base_csv, | ||
"added.csv": seeds_added_csv, | ||
"seeds.yml": schema_seed_added_yml, | ||
} | ||
|
||
|
||
class TestSnapshotTimestampRedshift(BaseSnapshotTimestamp): | ||
# Redshift defines the 'name' column such that it's not big enough | ||
# to hold the '_update' added in the test. | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"base.csv": seeds_base_csv, | ||
"added.csv": seeds_added_csv, | ||
"newcolumns.csv": seeds_newcolumns_csv, | ||
"seeds.yml": schema_seed_added_yml, | ||
} |
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