Skip to content

Commit ed57a10

Browse files
Update dependencies in requirements.txt and clean up unused imports in collector and filesystem_collector modules; enhance tests by removing unnecessary assertions and print statements. (#147)
1 parent d8b706d commit ed57a10

File tree

8 files changed

+19
-41
lines changed

8 files changed

+19
-41
lines changed

requirements.txt

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@ ansible-core==2.17.14
1313
# ansible-lint
1414
ansible-lint==25.9.2
1515
# via -r requirements.in
16-
ansible-runner==2.4.1
16+
ansible-runner==2.4.2
1717
# via -r requirements.in
1818
astroid==4.0.1
1919
# via pylint
2020
attrs==25.4.0
2121
# via
2222
# jsonschema
2323
# referencing
24-
azure-common==1.1.28
25-
# via azure-mgmt-network
26-
azure-core==1.35.1
24+
azure-core==1.36.0
2725
# via
2826
# azure-identity
2927
# azure-kusto-data
@@ -47,7 +45,7 @@ azure-mgmt-core==1.6.0
4745
# via
4846
# azure-mgmt-compute
4947
# azure-mgmt-network
50-
azure-mgmt-network==29.0.0
48+
azure-mgmt-network==30.0.0
5149
# via -r requirements.in
5250
azure-storage-blob==12.23.0
5351
# via
@@ -71,17 +69,17 @@ cffi==2.0.0
7169
# via
7270
# ansible-lint
7371
# cryptography
74-
charset-normalizer==3.4.3
72+
charset-normalizer==3.4.4
7573
# via requests
7674
click==8.3.0
7775
# via
7876
# -r requirements.in
7977
# black
80-
coverage[toml]==7.10.7
78+
coverage[toml]==7.11.0
8179
# via
8280
# -r requirements.in
8381
# pytest-cov
84-
cryptography==46.0.2
82+
cryptography==46.0.3
8583
# via
8684
# ansible-core
8785
# ansible-lint
@@ -104,11 +102,10 @@ ijson==3.4.0.post0
104102
# via azure-kusto-data
105103
importlib-metadata==8.7.0
106104
# via ansible-lint
107-
iniconfig==2.1.0
105+
iniconfig==2.3.0
108106
# via pytest
109107
isodate==0.7.2
110108
# via
111-
# azure-mgmt-network
112109
# azure-storage-blob
113110
# azure-storage-queue
114111
# msrest
@@ -144,7 +141,9 @@ msal==1.34.0
144141
msal-extensions==1.3.1
145142
# via azure-identity
146143
msrest==0.7.1
147-
# via azure-mgmt-compute
144+
# via
145+
# azure-mgmt-compute
146+
# azure-mgmt-network
148147
mypy-extensions==1.1.0
149148
# via black
150149
numpy==2.2.6
@@ -190,7 +189,7 @@ pyjwt[crypto]==2.10.1
190189
# via
191190
# msal
192191
# pyjwt
193-
pylint==4.0.0
192+
pylint==4.0.2
194193
# via -r requirements.in
195194
pytest==8.4.2
196195
# via
@@ -207,7 +206,7 @@ python-dateutil==2.9.0.post0
207206
# via
208207
# azure-kusto-data
209208
# pandas
210-
pytokens==0.1.10
209+
pytokens==0.2.0
211210
# via black
212211
pytz==2025.2
213212
# via pandas
@@ -238,20 +237,18 @@ resolvelib==1.0.1
238237
# via ansible-core
239238
rich==14.2.0
240239
# via -r requirements.in
241-
rpds-py==0.27.1
240+
rpds-py==0.28.0
242241
# via
243242
# jsonschema
244243
# referencing
245-
ruamel-yaml==0.18.15
244+
ruamel-yaml==0.18.16
246245
# via ansible-lint
247246
ruamel-yaml-clib==0.2.14
248247
# via
249248
# ansible-lint
250249
# ruamel-yaml
251250
six==1.17.0
252-
# via
253-
# azure-core
254-
# python-dateutil
251+
# via python-dateutil
255252
subprocess-tee==0.4.2
256253
# via
257254
# ansible-compat

src/module_utils/collector.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import logging
1010
import re
1111
import shlex
12-
import ipaddress
1312
from typing import Any
1413

1514
try:

src/module_utils/filesystem_collector.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
Collectors for data collection in SAP Automation QA
66
"""
77
import json
8-
from abc import ABC, abstractmethod
98
import logging
10-
import re
11-
import shlex
12-
import ipaddress
139
from typing import Any
1410

1511
try:
@@ -450,14 +446,12 @@ def gather_all_filesystem_info(
450446
fstype = fs.get("fstype", "")
451447
stripe_size = fs.get("stripe_size", "")
452448
stripes = ""
453-
lv_size = ""
454449

455450
if not stripe_size and vg_name and source:
456451
for lv_name, lv_info in lvm_volumes.items():
457452
if lv_info.get("dm_path") == source:
458453
stripe_size = lv_info.get("stripe_size", "")
459454
stripes = lv_info.get("stripes", "")
460-
lv_size = lv_info.get("size", "")
461455
self.parent.log(
462456
logging.INFO,
463457
f"Found LVM details for {target}: "

tests/module_utils/collector_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
Unit tests for the collector module.
66
"""
77

8+
import pytest
89
import json
910
from typing import Any, Dict
10-
from unittest.mock import Mock
1111

12-
import pytest
1312

1413
from src.module_utils.collector import (
1514
AzureDataParser,

tests/module_utils/filesystem_collector_test.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99
Tests use pytest with monkeypatch for mocking, avoiding unittest entirely.
1010
"""
1111

12-
import json
13-
import logging
14-
from typing import Any, Dict, List
15-
from unittest.mock import Mock
16-
1712
import pytest
18-
13+
from typing import Any, Dict
1914
from src.module_utils.filesystem_collector import FileSystemCollector
2015

2116

@@ -768,7 +763,7 @@ def test_collect_empty_lvm_fullreport(self, collector, mock_parent):
768763
"mount_info": "/data /dev/sdc xfs rw",
769764
"df_info": "Filesystem 1K-blocks Used Available Use% Mounted\n/dev/sdc 524288000 52428800 471859200 10% /data",
770765
}
771-
result = collector.collect(MockCheck(), context)
766+
collector.collect(MockCheck(), context)
772767
assert any(
773768
"lvm_fullreport is empty or invalid" in log["message"] for log in mock_parent.logs
774769
)

tests/module_utils/get_pcmk_properties_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,5 @@ def test_check_required_resources_optional(self, validator):
490490
"meta_attributes": {},
491491
}
492492
validator.RESOURCE_CATEGORIES["optional_resource"] = ".//primitive[@type='NonExistent']"
493-
494-
initial_message = validator.result["message"]
495493
validator._check_required_resources()
496494
assert "Required resource 'optional_resource'" not in validator.result["message"]

tests/modules/configuration_check_module_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
"""
1111

1212
import json
13-
import logging
1413
from datetime import datetime
1514
from typing import Any, Dict, Optional
16-
from unittest.mock import Mock, MagicMock, patch
15+
from unittest.mock import Mock, patch
1716

1817
import pytest
1918

@@ -698,7 +697,6 @@ def test_get_results_summary_empty(self, config_module):
698697

699698
def test_get_results_summary_with_results(self, config_module, sample_check):
700699
"""Test summary with mixed results"""
701-
# Create mock result objects with status as string values for summary
702700
result1 = Mock()
703701
result1.status = TestStatus.SUCCESS.value
704702
result1.check = sample_check

tests/modules/get_azure_lb_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ def test_get_load_balancers_details(self, azure_lb):
115115
:type azure_lb: AzureLoadBalancer
116116
"""
117117
azure_lb.get_load_balancers_details()
118-
print(f"\n\nResult: {azure_lb.result}")
119-
print(f"Parameters: {azure_lb.result['details']['parameters']}")
120118
assert azure_lb.result["status"] == "PASSED"
121119
assert azure_lb.result["details"]["parameters"] is not None
122120

0 commit comments

Comments
 (0)