Index: pkpgcounter/trunk/tests/gstests.py
===================================================================
--- pkpgcounter/trunk/tests/gstests.py (revision 564)
+++ pkpgcounter/trunk/tests/gstests.py (revision 3436)
@@ -1,4 +1,4 @@
 #! /usr/bin/env python
-# -*- coding: UTF-8 -*-
+# -*- coding: utf-8 -*-
 #
 # pkpgcounter : a generic Page Description Language parser
@@ -9,10 +9,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -43,11 +43,11 @@
         self.md5sum = self.computeChecksum()
         self.mastersize = None
-        
-    def __del__(self) :    
+
+    def __del__(self) :
         """Remove temporary file, if any."""
         if self.tmp is not None :
             self.tmp.close()
-            
-    def computeChecksum(self) :    
+
+    def computeChecksum(self) :
         """Computes an MD5 checksum for the input file's content."""
         checksum = md5.new()
@@ -60,25 +60,25 @@
             infile = sys.stdin
             istemp = True
-        else :    
+        else :
             infile = open(self.inputfile, "rb")
-            
+
         while True :
             data = infile.read(MEGABYTE)
             if not data :
                 break
-            if istemp :    
+            if istemp :
                 self.tmp.write(data)
             checksum.update(data)
-            
-        if istemp :    
-            self.tmp.flush()    
+
+        if istemp :
+            self.tmp.flush()
         else :
             infile.close()
-            
-        return checksum.hexdigest()    
-        
+
+        return checksum.hexdigest()
+
     def getAvailableDevices(self) :
         """Returns a list of available GhostScript devices.
-        
+
            The list is returned without any x11, bbox, nor ijs related device.
         """
@@ -93,14 +93,14 @@
                                            and (not dev == "/nullpage") \
                                            and (not dev == "/bbox") ]
-                devices.sort()                           
+                devices.sort()
                 return devices
         return []
-            
+
     def getAvailableIJSPrintClasses(self) :
         """Returns a list of available IJS Print Classes.
-        
+
            Currently the list is a static one and doesn't contain all the available print classes.
         """
-        return [ "DJ3600", "DJ3320", "DJ9xx", "DJGenericVIP", "LJColor", 
+        return [ "DJ3600", "DJ3320", "DJ9xx", "DJGenericVIP", "LJColor",
                  "DJ850", "DJ890", "DJ9xxVIP", "DJ8xx", "DJ540", "DJ660",
                  "DJ6xx", "DJ350", "DJ6xxPhoto", "DJ630", "DJ8x5", "DJ4100",
@@ -108,5 +108,5 @@
                  "Postscript", "LJJetReady", "LJMono", "LJFastRaster",
                  "LJZjsMono", ]
-            
+
     def batchGeneration(self, infilename, devices, root, command) :
         """Loops over a set of devices calling a particular command."""
@@ -121,16 +121,16 @@
             if os.path.exists(outfilename) and os.stat(outfilename).st_size :
                 sys.stdout.write("Skipping %(outfilename)s : already exists.\n" % locals())
-            else :    
+            else :
                 sys.stdout.write("Generating %(outfilename)s " % locals())
                 sys.stdout.flush()
                 os.system(cmd)
                 sys.stdout.write("\n")
-                
+
             if not os.path.exists(outfilename) :
                 sys.stderr.write("ERROR : During the generation of %(outfilename)s\n" % locals())
-            elif not os.stat(outfilename).st_size :    
+            elif not os.stat(outfilename).st_size :
                 sys.stderr.write("ERROR : Unsupported driver, impossible to generate %(outfilename)s\n" % locals())
                 os.remove(outfilename)
-            else :    
+            else :
                 self.results[outfilename] = { "command" : cmd,
                                               "device" : "%s" % (devprefix + device),
@@ -138,32 +138,32 @@
                                               "details" : None,
                                             }
-                
+
     def genTestSuite(self) :
         """Generate the testsuite."""
         root = "testsuite.%s" % self.md5sum
-        self.batchGeneration(self.inputfile, self.getAvailableDevices(), 
-                                        root, 
+        self.batchGeneration(self.inputfile, self.getAvailableDevices(),
+                                        root,
                                         'gs -dQUIET -dBATCH -dNOPAUSE -dPARANOIDSAFER -sOutputFile="%(outfilename)s" -sDEVICE="%(device)s" "%(infilename)s"')
-                                    
-        self.batchGeneration(self.inputfile, self.getAvailableIJSPrintClasses(), 
-                                        "%(root)s.hpijs" % locals(), 
+
+        self.batchGeneration(self.inputfile, self.getAvailableIJSPrintClasses(),
+                                        "%(root)s.hpijs" % locals(),
                                         '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) :            
+
+    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 :        
+        finally :
             answerfd.close()
-        
-    def computeSize(self, filename) :    
+
+    def computeSize(self, filename) :
         """Computes the size in pages of a file in the testsuite."""
         answer = self.runPipe('pkpgcounter "%(filename)s" 2>/dev/null' % locals())
         try :
             return int(answer)
-        except (ValueError, TypeError) :    
+        except (ValueError, TypeError) :
             return 0
-        
+
     def runTests(self) :
         """Launches the page counting tests against the testsuite."""
@@ -172,5 +172,5 @@
         if not mastersize :
             raise RuntimeError, "Unable to compute the size of the testsuite's master file %(masterfilename)s" % locals()
-        else :    
+        else :
             sys.stdout.write("Master file's contains %(mastersize)i pages.\n" % locals())
         testsuite = glob.glob("testsuite.*")
@@ -181,9 +181,9 @@
             if len(parts) > 3 :
                 devname = ".".join(parts[2:])
-            else :    
+            else :
                 devname = parts[-1]
-            result = self.results.setdefault(testfname, { "command" : "See above", 
-                                                          "device" : devname, 
-                                                          "result" : None, 
+            result = self.results.setdefault(testfname, { "command" : "See above",
+                                                          "device" : devname,
+                                                          "result" : None,
                                                           "details" : None })
             sys.stdout.write("Testing %(testfname)s ... " % locals())
@@ -194,15 +194,15 @@
                     result["result"] = "UNSUPPORTED"
                     result["details"] = "Unsupported file format"
-                else :    
+                else :
                     result["result"] = "FAILED"
                     result["details"] = "Found %(size)i pages instead of %(mastersize)i\n" % locals()
-            else :    
+            else :
                 result["result"] = "SUPPORTED"
                 result["details"] = None
-            sys.stdout.write("%s\n" % result["result"])    
+            sys.stdout.write("%s\n" % result["result"])
         self.supportedpct = 100.0 * len([True for r in self.results.values() if r["result"] == "SUPPORTED"]) / nbtests
         self.failedpct = 100.0 * len([True for r in self.results.values() if r["result"] == "FAILED"]) / nbtests
         self.unsupportedpct = 100.0 * len([True for r in self.results.values() if r["result"] == "UNSUPPORTED"]) / nbtests
-        
+
     def genHTMLReport(self, filename) :
         """Generates an HTML report."""
@@ -232,15 +232,15 @@
         for key in keys :
             value = self.results[key]
-            linecount += 1    
-            if not (linecount % 2) :    
+            linecount += 1
+            if not (linecount % 2) :
                 linecolor = "#DEDEDE"
-            else :    
+            else :
                 linecolor = "#FFFFFF"
-            out.write('<tr bgcolor="%s">\n' % linecolor)    
+            out.write('<tr bgcolor="%s">\n' % linecolor)
             if value["result"] == "SUPPORTED" :
                 color = "#00FF00"
-            elif value["result"] == "UNSUPPORTED" :    
+            elif value["result"] == "UNSUPPORTED" :
                 color = "#FF0000"
-            else :    
+            else :
                 color = "orange"
             out.write('<td bgcolor="%s"><strong>%s</strong></td>\n' % (color, value["device"]))
@@ -250,6 +250,6 @@
         out.write("</table></body></html>\n")
         out.close()
-        
-def main() :        
+
+def main() :
     """Main function."""
     try :
@@ -259,13 +259,13 @@
             sys.stderr.write("usage : %s [inputfile.ps]\n" % sys.argv[0])
             sys.exit(-1)
-        else :    
+        else :
             testsuite = TestSuite(sys.argv[1])
             testsuite.genTestSuite()
             testsuite.runTests()
             testsuite.genHTMLReport("%s.html" % testsuite.md5sum)
-    except KeyboardInterrupt :        
+    except KeyboardInterrupt :
         sys.stderr.write("Interrupted at user's request !\n")
-        
+
 if __name__ == "__main__" :
     sys.exit(main())
-        
+
