Skip to content

Commit

Permalink
Add a test for disabling rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jochemvandooren committed May 2, 2024
1 parent a465a29 commit 933207d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_rule_registry.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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()
Expand Down

0 comments on commit 933207d

Please sign in to comment.