Skip to content

Commit

Permalink
Fix tests, code checks, cheat mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed Sep 26, 2021
1 parent 51274cc commit 3d654c4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,23 +308,23 @@ def _parse_generic_test(
raise CompilationException(msg) from exc
original_name = os.path.basename(target.original_file_path)
compiled_path = get_pseudo_test_path(builder.compiled_name, original_name)

fqn_path = []
# generic tests defined on sources: piggypack off the source table FQN,
# which is yaml file relative path + source name + source table name
if hasattr(target, "fqn"):
fqn_path.extend(target.fqn)
fqn_path.extend(target.fqn) # type: ignore
# otherwise: build FQN out of yaml file relative path + target name
elif path:
fqn_path = self.get_fqn_prefix(path.relative_path)
fqn_path = self.get_fqn_prefix(path.relative_path) # type: ignore
fqn_path.append(target.name)
# we shouldn't ever get here
else:
fqn_path = get_pseudo_test_path(builder.fqn_name, original_name)
# if defined on a column, include column name in the FQN
if column_name:
fqn_path.append(column_name)

# finally, add the test name itself
fqn = fqn_path + [builder.fqn_name]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_postgres_changed_seed_contents_state(self):

results = self.run_dbt(['ls', '--select', 'state:modified+', '--state', './state'])
assert len(results) == 7
assert set(results) == {'test.seed', 'test.table_model', 'test.view_model', 'test.ephemeral_model', 'test.test.not_null_view_model_id', 'test.test.unique_view_model_id', 'exposure:test.my_exposure'}
assert set(results) == {'test.seed', 'test.table_model', 'test.view_model', 'test.ephemeral_model', 'test.view_model.id.not_null_view_model_id', 'test.view_model.id.unique_view_model_id', 'exposure:test.my_exposure'}

shutil.rmtree('./state')
self.copy_state()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def list_tests_and_assert(self, include, exclude, expected_tests, greedy=False,
listed = self.run_dbt(list_args)
assert len(listed) == len(expected_tests)

test_names = [name.split('.')[2] for name in listed]
test_names = [name.split('.')[-1] for name in listed]
assert sorted(test_names) == sorted(expected_tests)

def run_tests_and_assert(self, include, exclude, expected_tests, greedy=False, selector_name=None):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from test.integration.base import DBTIntegrationTest, FakeArgs, use_profile


class TestSelectionExpansion(DBTIntegrationTest):
class TestIncrementalSchemaChange(DBTIntegrationTest):
@property
def schema(self):
return "test_incremental_schema_069"
return "test_incremental_schema_070"

@property
def models(self):
Expand All @@ -28,7 +28,7 @@ def list_tests_and_assert(self, include, exclude, expected_tests):
print(listed)
assert len(listed) == len(expected_tests)

test_names = [name.split('.')[2] for name in listed]
test_names = [name.split('.')[-1] for name in listed]
assert sorted(test_names) == sorted(expected_tests)

def run_tests_and_assert(
Expand Down

0 comments on commit 3d654c4

Please sign in to comment.