gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: gump/python/gump/test resulting.py
Date Sun, 11 Apr 2004 23:50:29 GMT
ajack       2004/04/11 16:50:29

  Modified:    python/gump/results resulter.py model.py
               python/gump/test resulting.py
  Log:
  Added unit test to fix failure to detect server differences.
  (It was setting a variable with a typo in it, not the real one).
  
  Revision  Changes    Path
  1.22      +1 -21     gump/python/gump/results/resulter.py
  
  Index: resulter.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/results/resulter.py,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- resulter.py	11 Apr 2004 15:18:43 -0000	1.21
  +++ resulter.py	11 Apr 2004 23:50:29 -0000	1.22
  @@ -35,27 +35,7 @@
   from gump.results.model import *
   from gump.results.loader import *
   
  -class ResultsSet(dict):
  -    def __init__(self):
  -        dict.__init__(self)
  -        
  -        self.calculated=0
  -        self.differences=0
  -        
  -    def hasDifferences(self):
  -        if self.calculated: return self.differences
  -        
  -        lastPair=None
  -        for result in self.values():
  -            statePair=result.getStatePair()            
  -            if lastPair:
  -                if lastPair <> statePair:
  -                    self.differeces=1
  -            lastPair=statePair
  -            
  -        self.calculated=1
  -        return self.differences
  -                    
  +               
   class Resulter:
       
       def __init__(self,run):        
  
  
  
  1.13      +21 -0     gump/python/gump/results/model.py
  
  Index: model.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/results/model.py,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- model.py	11 Apr 2004 15:18:43 -0000	1.12
  +++ model.py	11 Apr 2004 23:50:29 -0000	1.13
  @@ -154,6 +154,27 @@
               return self.getOwner().getEndDateTimeUtc()       
           return self.endDateTimeUtc
            
  +class ResultsSet(dict):
  +    def __init__(self):
  +        dict.__init__(self)
  +        
  +        self.calculated=0
  +        self.differences=0
  +        
  +    def hasDifferences(self):
  +        if self.calculated: return self.differences
  +        
  +        lastPair=None
  +        for result in self.values():
  +            statePair=result.getStatePair()            
  +            if lastPair:
  +                if lastPair <> statePair:
  +                    self.differences=1
  +            lastPair=statePair
  +            
  +        self.calculated=1
  +        return self.differences
  +     
   
   # represents a <workspaceResult/> element
   class WorkspaceResult(ResultModelObject):
  
  
  
  1.5       +26 -0     gump/python/gump/test/resulting.py
  
  Index: resulting.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/resulting.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- resulting.py	2 Apr 2004 16:48:06 -0000	1.4
  +++ resulting.py	11 Apr 2004 23:50:29 -0000	1.5
  @@ -26,6 +26,8 @@
   from gump.gumprun import GumpRun
   from gump.test import getWorkedTestWorkspace
   from gump.test.pyunit import UnitTestSuite
  +from gump.model.state import *
  +from gump.results.model import *
   from gump.results.resulter import generateResults,Resulter
   from gump.results.loader import WorkspaceResultLoader
   from gump.net.mailer import *
  @@ -90,4 +92,28 @@
   
           # Load for all servers...
           resulter.loadResultsForServers()        
  +        
  +    def testNoDifferences(self):
  +        r=ResultsSet()
  +        
  +        m1= ResultModelObject('a')
  +        r['a']=m1
  +        
  +        m2= ResultModelObject('b')
  +        r['b']=m2
  +        
  +        self.assertFalse('No Differences', r.hasDifferences())
  +              
  +        
  +    def testDifferences(self):
  +        r=ResultsSet()
  +        
  +        m1= ResultModelObject('a')
  +        m1.setStatePair(StatePair(STATE_SUCCESS,REASON_UNSET))
  +        r['a']=m1
  +        
  +        m2= ResultModelObject('b')
  +        r['b']=m2
  +        
  +        self.assertTrue('Differences', r.hasDifferences())
           
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Mime
View raw message