summaryrefslogtreecommitdiffstats
path: root/test/test_rules_collection.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_rules_collection.py')
-rw-r--r--test/test_rules_collection.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/test_rules_collection.py b/test/test_rules_collection.py
index 66c69ec..44317fe 100644
--- a/test/test_rules_collection.py
+++ b/test/test_rules_collection.py
@@ -1,4 +1,5 @@
"""Tests for rule collection class."""
+
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -23,14 +24,17 @@ from __future__ import annotations
import collections
import re
from pathlib import Path
+from typing import TYPE_CHECKING
import pytest
-from ansiblelint.config import options
from ansiblelint.file_utils import Lintable
from ansiblelint.rules import RulesCollection
from ansiblelint.testing import run_ansible_lint
+if TYPE_CHECKING:
+ from ansiblelint.config import Options
+
@pytest.fixture(name="test_rules_collection")
def fixture_test_rules_collection() -> RulesCollection:
@@ -153,12 +157,12 @@ def test_rich_rule_listing() -> None:
assert rule.description[:30] in result.stdout
-def test_rules_id_format() -> None:
+def test_rules_id_format(config_options: Options) -> None:
"""Assure all our rules have consistent format."""
rule_id_re = re.compile("^[a-z-]{4,30}$")
rules = RulesCollection(
[Path("./src/ansiblelint/rules").resolve()],
- options=options,
+ options=config_options,
conditional=False,
)
keys: set[str] = set()
@@ -171,5 +175,5 @@ def test_rules_id_format() -> None:
rule.help or rule.description or rule.__doc__
), f"Rule {rule.id} must have at least one of: .help, .description, .__doc__"
assert "yaml" in keys, "yaml rule is missing"
- assert len(rules) == 49 # update this number when adding new rules!
+ assert len(rules) == 50 # update this number when adding new rules!
assert len(keys) == len(rules), "Duplicate rule ids?"