ajack 2004/01/09 15:02:32 Modified: python/gump/output statsdb.py python/gump engine.py python/gump/test pyunit.py stats.py python/gump/model stats.py python/gump/document forrest.py Log: Working on some stats unit tests (which I can only test on Linux 'cos Python DBM doesn't work on M$) Trying to figure out why the counter on LSD (and no doubt others) are bogus. Revision Changes Path 1.9 +4 -0 jakarta-gump/python/gump/output/statsdb.py Index: statsdb.py =================================================================== RCS file: /home/cvs/jakarta-gump/python/gump/output/statsdb.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- statsdb.py 9 Jan 2004 19:57:18 -0000 1.8 +++ statsdb.py 9 Jan 2004 23:02:32 -0000 1.9 @@ -333,6 +333,10 @@ # self.putProjectStats(ps) + def sync(self): + if not os.name == 'dos' and not os.name == 'nt': + self.db.sync() + class WorkspaceStatisticsGuru: """ Know it all for a workspace... """ def __init__(self, workspace): 1.46 +3 -0 jakarta-gump/python/gump/engine.py Index: engine.py =================================================================== RCS file: /home/cvs/jakarta-gump/python/gump/engine.py,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- engine.py 9 Jan 2004 19:57:19 -0000 1.45 +++ engine.py 9 Jan 2004 23:02:32 -0000 1.46 @@ -559,3 +559,6 @@ # db.loadStatistics(workspace) + + db.sync() + 1.14 +4 -0 jakarta-gump/python/gump/test/pyunit.py Index: pyunit.py =================================================================== RCS file: /home/cvs/jakarta-gump/python/gump/test/pyunit.py,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- pyunit.py 9 Jan 2004 19:57:19 -0000 1.13 +++ pyunit.py 9 Jan 2004 23:02:32 -0000 1.14 @@ -97,6 +97,10 @@ if not object1 == object2: self.raiseIssue(['Ought evaluate as equal', message, object1, object2]) + def assertGreater(self,message,object1,object2): + if not object1 > object2: + self.raiseIssue(['Ought evaluate as greater', message, object1, object2]) + def assertNotEqual(self,message,object1,object2): if object1 == object2: self.raiseIssue(['Ought NOT evaluate as equal', message, object1, object2]) 1.5 +34 -0 jakarta-gump/python/gump/test/stats.py Index: stats.py =================================================================== RCS file: /home/cvs/jakarta-gump/python/gump/test/stats.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- stats.py 9 Jan 2004 19:57:19 -0000 1.4 +++ stats.py 9 Jan 2004 23:02:32 -0000 1.5 @@ -102,6 +102,40 @@ self.statsDB.putProjectStats(ps1) self.statsDB.putModuleStats(ms1) self.statsDB.putRepositoryStats(rs1) + + def testGetChangePutGetCheckStats(self): + # Get 1 + ps1=self.statsDB.getProjectStats(self.project1.getName()) + ms1=self.statsDB.getModuleStats(self.module1.getName()) + rs1=self.statsDB.getRepositoryStats(self.repo1.getName()) + + # Change + ps1s = ps1.successes + ps1.successes += 1 + + ps1f = ps1.failures + ps1.failures += 1 + + ps1p = ps1.prereqs + ps1.prereqs += 1 + + # Put + self.statsDB.putProjectStats(ps1) + self.statsDB.putModuleStats(ms1) + self.statsDB.putRepositoryStats(rs1) + + # Get 2 + ps2=self.statsDB.getProjectStats(self.project1.getName()) + ms2=self.statsDB.getModuleStats(self.module1.getName()) + rs2=self.statsDB.getRepositoryStats(self.repo1.getName()) + + self.assertGreater('Incremented Successes', ps2.successes, ps1s ) + self.assertGreater('Incremented Successes', ps2.failures, ps1f ) + self.assertGreater('Incremented Successes', ps2.prereqs, ps1p ) + + print str(ps1s) + ' : ' + str(ps1f) + ' : ' + str(ps1p) + + self.statsDB.sync() def testLoadAndUpdateStats(self): self.statsDB.loadStatistics(self.workspace) 1.3 +30 -33 jakarta-gump/python/gump/model/stats.py Index: stats.py =================================================================== RCS file: /home/cvs/jakarta-gump/python/gump/model/stats.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- stats.py 9 Jan 2004 19:57:18 -0000 1.2 +++ stats.py 9 Jan 2004 23:02:32 -0000 1.3 @@ -126,42 +126,39 @@ def sequenceInStateKey(self): return self.getKeyBase() + '-seq-state' - - def update(self,project): - # - # Update based off current run - # - if project.isSuccess(): - self.successes += 1 - self.last = gump.default.time - - # A big event... - if not self.first: - self.first=self.last - elif project.isFailed(): - s.failures += 1 - elif project.isPrereqFailed(): - s.prereqs += 1 - - # - # Deal with states & changes... - # - lastCurrentState=self.currentState - self.currentState=project.getState() - - if lastCurrentState==self.currentState: - self.startOfState = default.time - self.sequenceInState += 1 - else: - self.previousState=lastCurrentState - self.sequenceInState = 1 - +# def update(self,project): +# # +# # Update based off current run +# # +# if project.isSuccess(): +# +# self.successes += 1 +# self.last = gump.default.time +# +# # A big event... +# if not self.first: +# self.first=self.last +# elif project.isFailed(): +# s.failures += 1 +# elif project.isPrereqFailed(): +# s.prereqs += 1 +# +# # +# # Deal with states & changes... +# # +# lastCurrentState=self.currentState +# self.currentState=project.getState() +# +# if lastCurrentState==self.currentState: +# self.startOfState = default.time +# self.sequenceInState += 1 +# else: +# self.previousState=lastCurrentState +# self.sequenceInState = 1 def dump(self, indent=0, output=sys.stdout): gump.utils.dump(self) - - - + class Statable: def __init__(self): pass 1.48 +5 -5 jakarta-gump/python/gump/document/forrest.py Index: forrest.py =================================================================== RCS file: /home/cvs/jakarta-gump/python/gump/document/forrest.py,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- forrest.py 9 Jan 2004 21:19:39 -0000 1.47 +++ forrest.py 9 Jan 2004 23:02:32 -0000 1.48 @@ -806,14 +806,14 @@ addnSection=document.createSection('Additional Details') addnPara=addnSection.createParagraph() - addnPara.createLink(gumpSafeName(module.getName()) + '_details.html', \ + addnPara.createLink('index_details.html', \ 'More module details ...') document.serialize() document=XDocDocument('Module Details : ' + module.getName(), \ self.resolver.getFile(module, \ - module.getName() + '_details', \ + 'index_details', \ '.xml')) detailSection=document.createSection('Module Details')
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]