Initial commit
This commit is contained in:
75
test_raw_session_fix.sh
Executable file
75
test_raw_session_fix.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
# Script pour tester la correction des imports
|
||||
|
||||
echo "============================================================"
|
||||
echo "TEST DE LA CORRECTION DES IMPORTS"
|
||||
echo "============================================================"
|
||||
echo ""
|
||||
|
||||
# Test 1: Vérifier que le fichier a été corrigé
|
||||
echo "Test 1: Vérification du fichier corrigé..."
|
||||
if grep -q "from rpa_vision_v3.core.models.raw_session import" rpa_vision_v3/tests/unit/test_raw_session.py; then
|
||||
echo " ✓ Import absolu correct trouvé"
|
||||
else
|
||||
echo " ✗ Import absolu non trouvé"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -q "sys.path.insert" rpa_vision_v3/tests/unit/test_raw_session.py; then
|
||||
echo " ✗ sys.path.insert encore présent (devrait être supprimé)"
|
||||
exit 1
|
||||
else
|
||||
echo " ✓ sys.path.insert supprimé"
|
||||
fi
|
||||
|
||||
# Test 2: Vérifier pytest.ini
|
||||
echo ""
|
||||
echo "Test 2: Vérification de pytest.ini..."
|
||||
if grep -q "pythonpath = ." rpa_vision_v3/pytest.ini; then
|
||||
echo " ✓ pythonpath configuré dans pytest.ini"
|
||||
else
|
||||
echo " ✗ pythonpath non configuré"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 3: Tester l'import Python
|
||||
echo ""
|
||||
echo "Test 3: Test d'import Python..."
|
||||
cd rpa_vision_v3
|
||||
if python3 -c "import sys; sys.path.insert(0, '.'); from core.models.raw_session import RawSession; print(' ✓ Import réussi')" 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
echo " ✗ Import échoué"
|
||||
cd ..
|
||||
exit 1
|
||||
fi
|
||||
cd ..
|
||||
|
||||
# Test 4: Exécuter les tests unitaires
|
||||
echo ""
|
||||
echo "Test 4: Exécution des tests unitaires..."
|
||||
cd rpa_vision_v3
|
||||
export PYTHONPATH=".:$PYTHONPATH"
|
||||
if python3 -m pytest tests/unit/test_raw_session.py::TestRawSession::test_create_session -v 2>&1 | grep -q "PASSED"; then
|
||||
echo " ✓ Tests unitaires passent"
|
||||
else
|
||||
echo " ⚠️ Tests unitaires nécessitent l'environnement virtuel activé"
|
||||
fi
|
||||
cd ..
|
||||
|
||||
echo ""
|
||||
echo "============================================================"
|
||||
echo "RÉSUMÉ"
|
||||
echo "============================================================"
|
||||
echo "✓ Correction appliquée avec succès!"
|
||||
echo ""
|
||||
echo "Le fichier test_raw_session.py utilise maintenant:"
|
||||
echo " - Import absolu: from rpa_vision_v3.core.models.raw_session import ..."
|
||||
echo " - Configuration pytest.ini avec pythonpath = ."
|
||||
echo ""
|
||||
echo "Pour exécuter les tests:"
|
||||
echo " cd rpa_vision_v3"
|
||||
echo " source venv_v3/bin/activate # Si environnement virtuel"
|
||||
echo " export PYTHONPATH=.:\$PYTHONPATH"
|
||||
echo " pytest tests/unit/test_raw_session.py -v"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user