CVS: nondist/sandbox/magnus/tester runme.py,1.2,1.3

Magnus Lie Hetland <[email protected]> Mon, 09 Jun 2003 11:40:03 -0700
Newsgroups gmane.comp.python.anygui.cvs
Message-ID <[email protected]>
Update of /cvsroot/anygui/nondist/sandbox/magnus/tester
In directory sc8-pr-cvs1:/tmp/cvs-serv23907

Modified Files:
	runme.py 
Log Message:


Index: runme.py
===================================================================
RCS file: /cvsroot/anygui/nondist/sandbox/magnus/tester/runme.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** runme.py	8 Feb 2003 03:12:45 -0000	1.2
--- runme.py	9 Jun 2003 18:40:00 -0000	1.3
***************
*** 6,10 ****
  # display the test descriptions only once, below the table.
  
! import os, sys
  from time import *
  from glob import glob
--- 6,10 ----
  # display the test descriptions only once, below the table.
  
! import os, sys, re
  from time import *
  from glob import glob
***************
*** 12,15 ****
--- 12,18 ----
  from anygui.Utils import topologicalSort
  
+ BEGIN_COMMENT = re.compile('^<!-- begin (\w+) -->$')
+ END_COMMENT = re.compile('^<!-- end (\w+) -->$')
+ 
  TEST_DIR = 'tests'
  TEST_PAT = 'test_*.py'
***************
*** 112,120 ****
  <br />
  
! <hr />
  
  <h2>Test Results for <code>%sgui</code></h2>
  
!   """ % (strftime('%Y-%m-%d %H:%M:%S', localtime()), backend())
  
  FOOT = """\
--- 115,133 ----
  <br />
  
! """ % (strftime('%Y-%m-%d %H:%M:%S', localtime()),)
! 
! BACKEND_HEADER = """<hr />
! 
! <!-- begin %s -->
  
  <h2>Test Results for <code>%sgui</code></h2>
  
! """ % (backend(), backend())
! 
! BACKEND_FOOTER = """
! 
! <!-- end %s -->
! 
! """ % (backend(),)
  
  FOOT = """\
***************
*** 175,181 ****
--- 188,216 ----
          self.files = files
          self.resultFile = resultFile
+         self.readExisting()
          self.results = []
          self.setupGUI()
  
+     def readExisting(self):
+         self.existing = []
+         if not os.path.isfile(self.resultFile):
+             return
+         collect = False
+         for line in open(self.resultFile):
+             m = BEGIN_COMMENT.match(line)
+             if m and not m.group(1) == backend():
+                 collect = True
+                 continue
+             m = END_COMMENT.match(line)
+             if m:
+                 collect = False
+                 continue
+             if collect:
+                 self.existing.append(line)
+ 
+     def writeExisting(self, out):
+         for line in self.existing:
+             out.write(line)
+ 
      def setupGUI(self):
          self.win = Window(text='The Anygui Test Program')
***************
*** 232,237 ****
--- 267,275 ----
          out = open(self.resultFile, 'w')
          print >> out, HEAD
+         self.writeExisting(out)
+         print >> out, BACKEND_HEADER
          for result in self.results:
              print >> out, result
+         print >> out, BACKEND_FOOTER
          print >> out, FOOT
          out.close()



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.