Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CT-1099: Migrate test 071_commented_yaml_regression_3568_tests #6106

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions tests/functional/schema_tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@

"""

all_quotes_schema__schema_yml = """# models/schema.yml
# only comments here, which should be okay!
# https://github.com/dbt-labs/dbt-core/issues/3568"""

models_v2__render_test_cli_arg_models__schema_yml = """
version: 2

Expand Down
19 changes: 19 additions & 0 deletions tests/functional/schema_tests/test_schema_v2_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
macro_resolution_order_models__config_yml,
macro_resolution_order_models__my_model_sql,
alt_local_utils__macros__type_timestamp_sql,
all_quotes_schema__schema_yml,
)
from dbt.exceptions import ParsingException, CompilationException
from dbt.contracts.results import TestStatus
Expand Down Expand Up @@ -991,6 +992,24 @@ def test_invalid_schema_file(
assert re.search(r"'models' is not a list", str(exc))


class TestCommentedSchema:
@pytest.fixture(scope="class")
def models(self):
return {
"schema.yml": all_quotes_schema__schema_yml,
"model.sql": invalid_schema_models__model_sql,
}

def test_quoted_schema_file(self, project):
try:
# A schema file consisting entirely of quotes should not be a problem
run_dbt(['parse'])
except TypeError:
assert False, '`dbt parse` failed with a yaml file that is all comments with the same exception as 3568'
except Exception:
assert False, '`dbt parse` failed with a yaml file that is all comments'


class TestWrongSpecificationBlock:
@pytest.fixture(scope="class")
def models(self):
Expand Down