-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_modules.py
More file actions
78 lines (66 loc) · 2.6 KB
/
Copy pathtest_modules.py
File metadata and controls
78 lines (66 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
"""Test script to verify DevCleaner modules load correctly"""
import sys
print("="*80)
print("DevCleaner Module Import Test")
print("="*80)
try:
print("\n[1/5] Importing utils module...")
from modules.utils import (
is_protected_file, is_protected_directory, is_safe_to_delete,
is_file_old_enough, format_bytes, logger
)
print("✓ utils module imported successfully")
except Exception as e:
print(f"✗ Failed to import utils: {e}")
sys.exit(1)
try:
print("\n[2/5] Importing system_cleanup module...")
from modules.system_cleanup import SystemCleanup
cleanup = SystemCleanup()
print("✓ system_cleanup module imported successfully")
print(f" - Temp directories found: {len(cleanup.temp_dirs)}")
except Exception as e:
print(f"✗ Failed to import system_cleanup: {e}")
sys.exit(1)
try:
print("\n[3/5] Importing duplicate_finder module...")
from modules.duplicate_finder import DuplicateFinder
print("✓ duplicate_finder module imported successfully")
except Exception as e:
print(f"✗ Failed to import duplicate_finder: {e}")
sys.exit(1)
try:
print("\n[4/5] Importing resource_monitor module...")
from modules.resource_monitor import ResourceMonitor
monitor = ResourceMonitor()
print("✓ resource_monitor module imported successfully")
except Exception as e:
print(f"✗ Failed to import resource_monitor: {e}")
sys.exit(1)
try:
print("\n[5/5] Testing utility functions...")
# Test format_bytes
test_size = 1024 * 1024 * 512 # 512 MB
formatted = format_bytes(test_size)
print(f"✓ format_bytes(512MB) = {formatted}")
# Test is_protected_file
protected = is_protected_file("test.dll")
print(f"✓ is_protected_file('test.dll') = {protected}")
not_protected = is_protected_file("document.txt")
print(f"✓ is_protected_file('document.txt') = {not_protected}")
# Test is_protected_directory
system_dir = is_protected_directory(r"C:\Windows\System32\test.txt")
print(f"✓ is_protected_directory('C:\\Windows\\System32\\test.txt') = {system_dir}")
except Exception as e:
print(f"✗ Error testing functions: {e}")
sys.exit(1)
print("\n" + "="*80)
print("✓ All modules loaded successfully!")
print("="*80)
print("\nSummary:")
print(" • utils: Safety checks and logging")
print(" • system_cleanup: Temporary file cleanup with 1-hour protection")
print(" • duplicate_finder: SHA-256 based duplicate detection")
print(" • resource_monitor: System resource monitoring")
print("\nTo start the GUI application, run: python main.py")
print("="*80)