Skip to content

Commit a968230

Browse files
committed
Refactor ASCS migration and node crash tests to remove unused imports and improve docstring clarity
1 parent 722b2dc commit a968230

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

tests/roles/ascs_migration_test.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
mocks necessary Python modules and commands, and verifies the execution of the tasks.
1010
"""
1111

12-
import tempfile
13-
import os
14-
import json
1512
import shutil
1613
from pathlib import Path
1714
import pytest
@@ -59,7 +56,6 @@ def test_environment(self, ansible_inventory):
5956
},
6057
]
6158

62-
# Set up with common method
6359
temp_dir = self.setup_test_environment(
6460
ansible_inventory=ansible_inventory,
6561
task_name="ascs-migration",

tests/roles/ascs_node_crash_test.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
mocks necessary Python modules and commands, and verifies the execution of the tasks.
1010
"""
1111

12-
import tempfile
13-
import os
1412
import shutil
15-
import json
1613
from pathlib import Path
1714
import pytest
1815
from tests.roles.roles_testing_base import RolesTestingBase
@@ -44,7 +41,7 @@ def test_environment(self, ansible_inventory):
4441
4542
:param ansible_inventory: Path to the Ansible inventory file.
4643
:type ansible_inventory: str
47-
:yield: Path to the temporary test environment.
44+
:yield temp_dir: Path to the temporary test environment.
4845
:ytype: str
4946
"""
5047
temp_dir = self.setup_test_environment(

tests/roles/roles_testing_base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def ansible_inventory(self) -> Iterator[str]:
4949
Create a temporary Ansible inventory file for testing.
5050
This inventory contains two hosts (scs01 and scs02) with local connections.
5151
52-
:yield: Path to the temporary inventory file.
52+
:yield inventory_path: Path to the temporary inventory file.
5353
:ytype: Iterator[str]
5454
"""
5555
inventory_content = self.file_operations(
@@ -117,12 +117,19 @@ def setup_test_environment(
117117
Set up a standard test environment for Ansible role testing.
118118
119119
:param ansible_inventory: Path to the Ansible inventory file
120+
:type ansible_inventory: str
120121
:param task_name: Name of the task file to test (e.g., "ascs-migration")
122+
:type task_name: str
121123
:param task_description: Human-readable description of the test
124+
:type task_description: str
122125
:param module_names: List of modules to mock
126+
:type module_names: list
123127
:param additional_files: Additional files to copy beyond standard ones
128+
:type additional_files: list
124129
:param extra_vars_override: Dictionary of extra vars to override defaults
130+
:type extra_vars_override: dict
125131
:return: Path to the temporary test environment
132+
:rtype: str
126133
"""
127134
temp_dir = tempfile.mkdtemp()
128135

0 commit comments

Comments
 (0)