|
19 | 19 | DuplicateYAMLKeysDeprecation, |
20 | 20 | EnvironmentVariableNamespaceDeprecation, |
21 | 21 | GenericJSONSchemaValidationDeprecation, |
| 22 | + MissingPlusPrefixDeprecation, |
22 | 23 | ModelParamUsageDeprecation, |
23 | 24 | PackageRedirectDeprecation, |
24 | 25 | WEOIncludeExcludeDeprecation, |
@@ -614,6 +615,61 @@ def test_environment_variable_namespace_deprecation(self): |
614 | 615 | ) |
615 | 616 |
|
616 | 617 |
|
| 618 | +class TestMissingPlusPrefixDeprecation: |
| 619 | + @pytest.fixture(scope="class") |
| 620 | + def project_config_update(self): |
| 621 | + return {"seeds": {"path": {"enabled": True}}} |
| 622 | + |
| 623 | + @mock.patch.dict(os.environ, {"DBT_ENV_PRIVATE_RUN_JSONSCHEMA_VALIDATIONS": "True"}) |
| 624 | + @mock.patch("dbt.jsonschemas._JSONSCHEMA_SUPPORTED_ADAPTERS", {"postgres"}) |
| 625 | + def test_missing_plus_prefix_deprecation(self, project): |
| 626 | + event_catcher = EventCatcher(MissingPlusPrefixDeprecation) |
| 627 | + run_dbt(["parse", "--no-partial-parse"], callbacks=[event_catcher.catch]) |
| 628 | + assert len(event_catcher.caught_events) == 1 |
| 629 | + assert "Missing '+' prefix on `enabled`" in event_catcher.caught_events[0].info.msg |
| 630 | + |
| 631 | + |
| 632 | +class TestMissingPlusPrefixDeprecationSubPath: |
| 633 | + @pytest.fixture(scope="class") |
| 634 | + def project_config_update(self): |
| 635 | + return {"seeds": {"path": {"+enabled": True, "sub_path": {"enabled": True}}}} |
| 636 | + |
| 637 | + @mock.patch.dict(os.environ, {"DBT_ENV_PRIVATE_RUN_JSONSCHEMA_VALIDATIONS": "True"}) |
| 638 | + @mock.patch("dbt.jsonschemas._JSONSCHEMA_SUPPORTED_ADAPTERS", {"postgres"}) |
| 639 | + def test_missing_plus_prefix_deprecation_sub_path(self, project): |
| 640 | + event_catcher = EventCatcher(MissingPlusPrefixDeprecation) |
| 641 | + run_dbt(["parse", "--no-partial-parse"], callbacks=[event_catcher.catch]) |
| 642 | + assert len(event_catcher.caught_events) == 1 |
| 643 | + assert "Missing '+' prefix on `enabled`" in event_catcher.caught_events[0].info.msg |
| 644 | + |
| 645 | + |
| 646 | +class TestMissingPlusPrefixDeprecationCustomConfig: |
| 647 | + @pytest.fixture(scope="class") |
| 648 | + def project_config_update(self): |
| 649 | + return {"seeds": {"path": {"custom_config": True, "sub_path": {"+enabled": True}}}} |
| 650 | + |
| 651 | + @mock.patch.dict(os.environ, {"DBT_ENV_PRIVATE_RUN_JSONSCHEMA_VALIDATIONS": "True"}) |
| 652 | + @mock.patch("dbt.jsonschemas._JSONSCHEMA_SUPPORTED_ADAPTERS", {"postgres"}) |
| 653 | + def test_missing_plus_prefix_deprecation_sub_path(self, project): |
| 654 | + event_catcher = EventCatcher(MissingPlusPrefixDeprecation) |
| 655 | + run_dbt(["parse", "--no-partial-parse"], callbacks=[event_catcher.catch]) |
| 656 | + assert len(event_catcher.caught_events) == 1 |
| 657 | + assert "Missing '+' prefix on `custom_config`" in event_catcher.caught_events[0].info.msg |
| 658 | + |
| 659 | + |
| 660 | +class TestCustomConfigInDbtProjectYmlNoDeprecation: |
| 661 | + @pytest.fixture(scope="class") |
| 662 | + def project_config_update(self): |
| 663 | + return {"seeds": {"path": {"+custom_config": True}}} |
| 664 | + |
| 665 | + @mock.patch.dict(os.environ, {"DBT_ENV_PRIVATE_RUN_JSONSCHEMA_VALIDATIONS": "True"}) |
| 666 | + @mock.patch("dbt.jsonschemas._JSONSCHEMA_SUPPORTED_ADAPTERS", {"postgres"}) |
| 667 | + def test_missing_plus_prefix_deprecation_sub_path(self, project): |
| 668 | + note_catcher = EventCatcher(Note) |
| 669 | + run_dbt(["parse", "--no-partial-parse"], callbacks=[note_catcher.catch]) |
| 670 | + assert len(note_catcher.caught_events) == 0 |
| 671 | + |
| 672 | + |
617 | 673 | class TestJsonSchemaValidationGating: |
618 | 674 | @pytest.fixture(scope="class") |
619 | 675 | def models(self): |
|
0 commit comments