Repository navigation
Expand file tree
/
Copy pathtest_basic.py
More file actions
executable file
·71 lines (61 loc) · 2.13 KB
/
Copy pathtest_basic.py
File metadata and controls
executable file
·71 lines (61 loc) · 2.13 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
#!/usr/bin/env python3
"""
Basic tests for retroMaid components
"""
from pathlib import Path
# Test imports
print("Testing imports...")
from utils.config import Config
from utils.logger import Logger
from utils.filename import sanitize_filename, extract_region_from_filename, calculate_similarity
from core.xml_manager import GameListXML
from core.scanner import ROMScanner
print("✓ All imports successful")
# Test configuration
print("\nTesting configuration...")
config = Config("config.yaml")
print(f"✓ Config loaded")
print(f" ROMs path: {config.get('roms_path')}")
print(f" Primary scraper: {config.get('scrapers.primary')}")
# Test logger
print("\nTesting logger...")
logger = Logger.setup(log_file="test.log", level="INFO", console_output=False)
logger.info("Test log message")
print("✓ Logger initialized")
# Test filename utilities
print("\nTesting filename utilities...")
test_name = "Super Mario Bros. (USA) [!].nes"
sanitized = sanitize_filename(test_name)
region = extract_region_from_filename(test_name)
print(f" Original: {test_name}")
print(f" Sanitized: {sanitized}")
print(f" Region: {region}")
print("✓ Filename utilities working")
# Test similarity
sim = calculate_similarity("Super Mario Bros", "Super Mario Brothers")
print(f" Similarity: {sim:.1f}%")
# Test XML manager
print("\nTesting XML manager...")
test_xml_path = Path("roms/psx/gamelist.xml")
if test_xml_path.exists():
gamelist = GameListXML(test_xml_path)
stats = gamelist.get_statistics()
print(f"✓ XML loaded: {stats['total']} games")
print(f" Complete: {stats['complete']}")
print(f" Incomplete: {stats['incomplete']}")
else:
print(" (No test gamelist.xml found)")
# Test scanner
print("\nTesting ROM scanner...")
roms_path = Path("roms")
if roms_path.exists():
scanner = ROMScanner(roms_path)
systems = scanner.get_available_systems()
print(f"✓ Scanner initialized")
print(f" Found systems: {', '.join(systems)}")
if 'psx' in systems:
stats = scanner.get_statistics('psx')
print(f" PSX ROMs: {stats['total_roms']}")
else:
print(" (No roms directory found)")
print("\n✅ All basic tests passed!")