From 933207d046b0e6671aa468755e4a40ed09fe7f43 Mon Sep 17 00:00:00 2001 From: Jochem van Dooren Date: Thu, 2 May 2024 08:24:53 +0200 Subject: [PATCH] Add a test for disabling rules --- tests/test_rule_registry.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_rule_registry.py b/tests/test_rule_registry.py index 9401832..13f1d21 100644 --- a/tests/test_rule_registry.py +++ b/tests/test_rule_registry.py @@ -1,6 +1,7 @@ """Unit tests for the rule registry.""" import pytest +from dbt_score.config_parser import DbtScoreConfig from dbt_score.exceptions import DuplicatedRuleException from dbt_score.rule_registry import RuleRegistry @@ -15,6 +16,17 @@ def test_rule_registry_discovery(): ] +def test_disabled_rule_registry_discovery(): + """Ensure disabled rules are not discovered.""" + config = DbtScoreConfig() + config.disabled_rules = ["tests.rules.nested.example.rule_test_nested_example"] + r = RuleRegistry(config) + r._load("tests.rules") + assert sorted(r._rules.keys()) == [ + "tests.rules.example.rule_test_example", + ] + + def test_rule_registry_no_duplicates(): """Ensure no duplicate rule names can coexist.""" r = RuleRegistry()