Blog do projektu Open Source JavaHotel

niedziela, 11 września 2011

New version Boa tester

New version of Boa test framework.
In order to avoid CR/LF (DOS) and LF (Linux) hell I had to change a method for file comparison. I replaced standard filecmp.cmp function with manual line by line comparison. Source file.

Before:
  eq = filecmp.cmp(sou, dest)
  if not eq:
    logging.info("  different")
    res = 0

Now:
f1 = open(sou, "r")
 f2 = open(dest, "r")
 li1 = f1.readlines()
 li2 = f2.readlines()
 if len(li1) != len(li2) :
    logging.info(" number of lines is different")
    res = 0
    continue
 for i in range(0, len(li1))  :
 line1 = li1[i].rstrip()
 line2 = li2[i].rstrip()
 if line1 != line2 : 
    logging.info(" line number: " + str(i)  + " different")
    logging.info(line1)
    logging.info(line2)
    res = 0
    break

Brak komentarzy:

Prześlij komentarz