1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2011-2014 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 Python script for HOMARD
22 Copyright EDF-R&D 2014
28 #========================================================================
29 #========================================================================
30 def remove_dir(directory) :
32 Empties, then removes a directory.
33 Copyright EDF-R&D 2013
36 l_aux = os.listdir(directory)
38 fic_a = os.path.join(directory, fic)
39 if os.path.isdir(fic_a) :
47 #========================================================================
48 #========================================================================
49 def test_results(Rep_Test, Test_Name, dircase, n_iter_test_file, n_rep_test_file) :
52 Rep_Test: repertoire des tests
53 Test_Name: nom du test
54 dircase: repertoire des resultats du test
55 n_iter_test_file: numero de l'iteration a tester
56 n_rep_test_file: numero du repertoire de l'iteration a tester
57 Copyright EDF-R&D 2014
62 test_file_suff = "apad.%02d.bilan" % n_iter_test_file
63 rep_test_file = "I%02d" % n_rep_test_file
65 test_file = os.path.join(Rep_Test, Test_Name + "." + test_file_suff)
66 mess_error_ref = "\nReference file: " + test_file
68 file = open (test_file, "r")
69 mess_ref = file.readlines()
72 mess_error = mess_error_ref + "\nThis file does not exist.\n"
74 raise Exception(mess_error)
76 test_file = os.path.join(dircase, rep_test_file, test_file_suff)
77 if os.path.isfile (test_file) :
78 file = open (test_file, "r")
79 mess = file.readlines()
82 mess_error = "\nResult file: " + test_file
83 mess_error += "\nThis file does not exist.\n"
85 raise Exception(mess_error)
87 nblign = len(mess_ref)
88 if ( len(mess) != nblign ):
89 mess_error = mess_error_ref + "\nResult file: " + test_file
90 mess_error += "\nThe number of lines of the files are not the same.\n"
92 raise Exception(mess_error)
94 for num in range(nblign) :
95 if (( "creation" not in mess_ref[num] ) and ( mess_ref[num] != mess[num])) :
96 message_erreur = "\nRefe : " + mess_ref[num]
97 message_erreur += "Test : " + mess[num][:-1]
98 message_erreur += "\nThe test is different from the reference."
100 raise Exception(message_erreur)
107 #========================================================================
108 #========================================================================