Skip to content

Commit

Permalink
bugfix: ignore commented-out schema tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor McArthur committed Mar 14, 2017
1 parent e060aeb commit ef5e533
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dbt/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ def parse_schema_tests(tests, root_project, projects):

for model_name, test_spec in test_yml.items():
for test_type, configs in test_spec.get('constraints', {}).items():
if configs is None:
continue

for config in configs:
to_add = parse_schema_test(
test, model_name, config, test_type,
Expand Down
23 changes: 23 additions & 0 deletions test/unit/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,29 @@ def test__simple_schema_test(self):
}
)

def test__schema_test_with_comments(self):
tests = [{
'name': 'commented_test',
'resource_type': 'test',
'package_name': 'root',
'root_path': get_os_path('/usr/src/app'),
'path': 'commented_test.yml',
'raw_sql': None,
'raw_yml': '''
stripe_mrr:
constraints:
relationships:
# - {from: fly_customer_id, to: cio_accounts, field: id}
'''
}]

self.assertEquals(
dbt.parser.parse_schema_tests(
tests,
self.root_project_config,
{'root': self.root_project_config,
'snowplow': self.snowplow_project_config}),
{})

def test__simple_data_test(self):
tests = [{
Expand Down

0 comments on commit ef5e533

Please sign in to comment.