Skip to content

Commit 227809f

Browse files
kmeinerzkmeinerz1
andauthored
Fix code quality check of tests (#812)
* improved code quality in base * improved code quality in base * added changelog entry * updated project toml * quick and dirty test * pipeline check by exclkuding problems * checking if stderr is the rpoblkem * improved code quality in base * improved code quality in base * added changelog entry * updated project toml * removed unnecessary test * test code quality pipeline * alternative test code quality pipeline * restored --------- Co-authored-by: kmeinerz1 <kaithomas.meinerz@bwi.de>
1 parent bda2f8c commit 227809f

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Features
66

77
* add `replacer` processor to replace substrings in fields using a syntax similar to the `dissector`
8-
* add custom yaml tag `!include PATH_TO_YAML_FILE` that allows to include other yaml files.
8+
* add custom yaml tag `!include PATH_TO_YAML_FILE` that allows to include other yaml files.
99
* add custom yaml tags `!set_anchor ANCHOR_NAME` and `!load_anchor ANCHOR_NAME` that allow to use anchors across documents inside a file/stream.
1010

1111
### Improvements
@@ -20,6 +20,7 @@
2020
- Fixed typo and broken link in documentation
2121
- Fixed assign_callback error in confluentkafka input
2222
- Fixed error logging in ` _get_configuration`, which caused the github checks to fail
23+
- Resolved `mypy` errors in `BaseProcessorTestCase.` by ensuring `self.object` and `self.patchers` are not `None` before accessing attributes.
2324
- Fix domain resolver errors for invalid domains
2425
- Fixed deprecation warnings caused by datetime when using Python >= 3.12
2526

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,6 @@ max-attributes=12
180180
# List of method names used to declare (i.e. assign) instance attributes.
181181
defining-attr-methods="__init__,__new__,setUp"
182182
[tool.mypy]
183-
exclude = "(?x)(test_.+py)"
183+
exclude = "tests/.*"
184184
follow_imports = "skip"
185185
follow_imports_for_stubs = "True"

tests/unit/processor/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def set_rules(rules_dirs):
7676
return rules
7777

7878
def _load_rule(self, rule: dict | Rule):
79+
assert isinstance(self.object, Processor)
7980
self.object._rule_tree = RuleTree()
8081
rule = self.object.rule_class.create_from_dict(rule) if isinstance(rule, dict) else rule
8182
self.object._rule_tree.add_rule(rule)
@@ -116,6 +117,7 @@ def setup_method(self) -> None:
116117

117118
def teardown_method(self) -> None:
118119
"""teardown for all methods"""
120+
assert isinstance(self.patchers, list)
119121
while len(self.patchers) > 0:
120122
patcher = self.patchers.pop()
121123
patcher.stop()

0 commit comments

Comments
 (0)