Index: /pkpgcounter/trunk/tests/gstests.py =================================================================== --- /pkpgcounter/trunk/tests/gstests.py (revision 537) +++ /pkpgcounter/trunk/tests/gstests.py (revision 544) @@ -150,14 +150,19 @@ 'gs -dBATCH -dQUIET -dPARANOIDSAFER -dNOPAUSE -sDEVICE=ijs -sIjsServer=hpijs -dIjsUseOutputFD -sDeviceManufacturer="HEWLETT-PACKARD" -sDeviceModel="%(device)s" -sOutputFile="%(outfilename)s" "%(infilename)s"') + def runPipe(self, cmd) : + """Runs a command in a pipe, returns the command's output as a string.""" + answerfd = os.popen(cmd, "r") + try : + return answerfd.read().strip() + finally : + answerfd.close() + def computeSize(self, filename) : """Computes the size in pages of a file in the testsuite.""" - answerfd = os.popen('pkpgcounter "%(filename)s" 2>/dev/null' % locals(), "r") + answer = self.runPipe('pkpgcounter "%(filename)s" 2>/dev/null' % locals()) try : - try : - return int(answerfd.readline().strip()) - except (ValueError, TypeError) : - return 0 - finally : - answerfd.close() + return int(answer) + except (ValueError, TypeError) : + return 0 def runTests(self) : @@ -203,5 +208,8 @@ """Generates an HTML report.""" reportdate = "%s (UTC)" % time.asctime(time.gmtime(time.time())) - title = "pkpgcounter report for testsuite %s generated on %s" % (self.md5sum, reportdate) + title = "pkpgcounter v%s report for testsuite %s generated on %s" \ + % (self.runPipe("pkpgcounter --version"), \ + self.md5sum, \ + reportdate) out = open(filename, "w") out.write("
Green means that pkpgcounter obtained the expected result
\n") - out.write("Orange means that pkpgcounter obtained an incorrect result
\n") - out.write("Red means that pkpgcounter doesn't recognize the input file's format
\n") + out.write("Green means that pkpgcounter obtained the expected result.
\n") + out.write("Orange means that pkpgcounter obtained an incorrect result.IMPORTANT : if only 1 page is found, this is often due to image formats which don't support multiple pages anyway.
\n") + out.write("Red means that pkpgcounter doesn't recognize the input file's format.
\n") out.write('Device | Details | Command line |
---|