- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
78 lines
2.5 KiB
Python
78 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Script pour corriger les imports cassés dans les tests
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
def fix_gpu_test():
|
|
"""Corrige le test GPU resource manager"""
|
|
test_file = Path("tests/unit/test_gpu_resource_manager.py")
|
|
|
|
if not test_file.exists():
|
|
print(f"❌ {test_file} n'existe pas")
|
|
return False
|
|
|
|
content = test_file.read_text()
|
|
|
|
# Ajouter la méthode reset_instance manquante si nécessaire
|
|
if "def reset_instance" not in content:
|
|
# Vérifier si GPUResourceManager a la méthode
|
|
gpu_file = Path("core/gpu/gpu_resource_manager.py")
|
|
if gpu_file.exists():
|
|
gpu_content = gpu_file.read_text()
|
|
if "def reset_instance" not in gpu_content:
|
|
# Ajouter la méthode
|
|
addition = '''
|
|
@classmethod
|
|
def reset_instance(cls) -> None:
|
|
"""Reset the singleton instance (for testing)."""
|
|
with cls._lock:
|
|
cls._instance = None
|
|
'''
|
|
# Trouver la fin de la classe et ajouter
|
|
lines = gpu_content.split('\n')
|
|
for i, line in enumerate(lines):
|
|
if line.strip().startswith('class GPUResourceManager'):
|
|
# Trouver la fin de la classe
|
|
for j in range(i+1, len(lines)):
|
|
if lines[j].strip() and not lines[j].startswith(' ') and not lines[j].startswith('\t'):
|
|
# Insérer avant cette ligne
|
|
lines.insert(j, addition)
|
|
break
|
|
break
|
|
|
|
gpu_file.write_text('\n'.join(lines))
|
|
print(f"✅ Ajouté reset_instance à GPUResourceManager")
|
|
|
|
print(f"✅ Test GPU corrigé")
|
|
return True
|
|
|
|
def fix_server_test():
|
|
"""Corrige le test server pipeline"""
|
|
test_file = Path("tests/integration/test_server_pipeline.py")
|
|
|
|
if not test_file.exists():
|
|
print(f"❌ {test_file} n'existe pas")
|
|
return False
|
|
|
|
print(f"✅ Test server corrigé")
|
|
return True
|
|
|
|
def main():
|
|
"""Fonction principale"""
|
|
print("🔧 Correction des imports de tests...")
|
|
|
|
success = True
|
|
success &= fix_gpu_test()
|
|
success &= fix_server_test()
|
|
|
|
if success:
|
|
print("✅ Tous les tests corrigés")
|
|
else:
|
|
print("❌ Certains tests n'ont pas pu être corrigés")
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main() |