Refactor test imports: remove unused imports across configuration and modal test files
This commit is contained in:
parent
b0abec730c
commit
8b1c01c894
6 changed files with 8 additions and 17 deletions
|
@ -5,7 +5,6 @@ This module handles application settings and preferences.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ class Config:
|
||||||
loaded_settings = json.load(f)
|
loaded_settings = json.load(f)
|
||||||
# Merge with defaults to ensure all keys exist
|
# Merge with defaults to ensure all keys exist
|
||||||
self._settings.update(loaded_settings)
|
self._settings.update(loaded_settings)
|
||||||
except (json.JSONDecodeError, IOError) as e:
|
except (json.JSONDecodeError, IOError):
|
||||||
# If loading fails, use defaults
|
# If loading fails, use defaults
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -58,7 +57,7 @@ class Config:
|
||||||
|
|
||||||
with open(self.config_file, 'w') as f:
|
with open(self.config_file, 'w') as f:
|
||||||
json.dump(self._settings, f, indent=2)
|
json.dump(self._settings, f, indent=2)
|
||||||
except IOError as e:
|
except IOError:
|
||||||
# Silently fail if we can't save config
|
# Silently fail if we can't save config
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,8 @@ This module contains unit tests for the Config class,
|
||||||
validating configuration loading, saving, and management functionality.
|
validating configuration loading, saving, and management functionality.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest.mock import patch, mock_open
|
from unittest.mock import patch, mock_open
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,9 @@ This module contains unit tests for the ConfigModal class,
|
||||||
validating modal behavior and configuration interaction.
|
validating modal behavior and configuration interaction.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
from unittest.mock import Mock
|
||||||
from unittest.mock import Mock, patch
|
|
||||||
|
|
||||||
from textual.widgets import Checkbox, Button
|
from textual.widgets import Button
|
||||||
|
|
||||||
from hosts.core.config import Config
|
from hosts.core.config import Config
|
||||||
from hosts.tui.config_modal import ConfigModal
|
from hosts.tui.config_modal import ConfigModal
|
||||||
|
|
|
@ -5,12 +5,8 @@ This module contains unit tests for the HostsManagerApp class,
|
||||||
validating application behavior, navigation, and user interactions.
|
validating application behavior, navigation, and user interactions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
from unittest.mock import Mock, patch
|
||||||
import tempfile
|
|
||||||
from unittest.mock import Mock, patch, MagicMock
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from textual.widgets import DataTable, Static
|
|
||||||
|
|
||||||
from hosts.main import HostsManagerApp
|
from hosts.main import HostsManagerApp
|
||||||
from hosts.core.models import HostEntry, HostsFile
|
from hosts.core.models import HostEntry, HostsFile
|
||||||
|
|
|
@ -9,8 +9,8 @@ import pytest
|
||||||
import tempfile
|
import tempfile
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest.mock import Mock, patch, MagicMock
|
from unittest.mock import Mock, patch
|
||||||
from src.hosts.core.manager import PermissionManager, HostsManager, EditModeError
|
from src.hosts.core.manager import PermissionManager, HostsManager
|
||||||
from src.hosts.core.models import HostEntry, HostsFile
|
from src.hosts.core.models import HostEntry, HostsFile
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,9 @@ This module tests the save confirmation functionality when exiting edit entry mo
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
from textual.widgets import Input, Checkbox, Button
|
from textual.widgets import Button
|
||||||
|
|
||||||
from hosts.main import HostsManagerApp
|
from hosts.main import HostsManagerApp
|
||||||
from hosts.core.models import HostsFile, HostEntry
|
|
||||||
from hosts.tui.save_confirmation_modal import SaveConfirmationModal
|
from hosts.tui.save_confirmation_modal import SaveConfirmationModal
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue