Changeset fbfc3b in indico
- Timestamp:
- 06/18/10 18:55:12 (3 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
- Children:
- d160015
- Parents:
- e65840
- git-author:
- Jeremy Nguyen Xuan <jeremy.nguyen.xuan@…> (01/08/10 09:36:39)
- git-committer:
- Pedro Ferreira <jose.pedro.ferreira@…> (06/18/10 18:55:12)
- Files:
-
- 3 edited
-
indicop/Indicop.py (modified) (7 diffs)
-
indicop/python/pylint/pylint.conf (modified) (1 diff)
-
setup.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
indicop/Indicop.py
re65840 rfbfc3b 34 34 35 35 36 class Indicop(object):36 class BaseTest(object): 37 37 #path to this current file 38 38 setupDir = os.path.dirname(__file__) … … 43 43 f.close() 44 44 45 def main(self, specify, coverage, jsSpecify, jsCoverage, testsToRun): 46 47 #define the set of tests 48 testsDict = {'unit': Unit(), 49 'functional': Functional(), 50 'pylint': Pylint(), 51 'jsunit': Jsunit(jsSpecify, jsCoverage), 52 'jslint': Jslint()} 53 54 returnString = "\n\n=============== ~INDICOP SAYS~ ===============\n\n" 55 56 if coverage: 57 figleaf.start() 58 59 60 #specified test can either be unit or functional. 61 #It makes more sense to run it here. 62 if specify: 63 #running directly the test here and ouputing in the console 64 result = nose.run(argv=['nose', '-v', os.path.join(self.setupDir, 65 'python', 66 specify)]) 67 if result: 68 returnString += "Specified Test - Succeeded\n" 69 else: 70 returnString += "[FAIL] Specified Test - \ 71 read output from console\n" 72 else: 73 for test in testsToRun: 74 try: 75 returnString += testsDict[test].run() 76 except KeyError: 77 returnString += ("[ERR] Test %s does not exist. " 78 "It has to be added in the testsDict variable\n") % test 79 80 81 if coverage: 82 figleaf.stop() 83 coverageOutput = figleaf.get_data().gather_files() 84 coverageDir = os.path.join(self.setupDir, 'report', 'pycoverage') 85 try: 86 figleaf.annotate_html.report_as_html(coverageOutput, 87 coverageDir, [], {}) 88 except IOError: 89 os.mkdir(coverageDir) 90 figleaf.annotate_html.report_as_html(coverageOutput, 91 coverageDir, [], {}) 92 returnString += ("PY Unit Test - Report generated in " 93 "report/pycoverage/index.html\n") 94 95 96 return returnString 97 98 99 class Unit(Indicop): 45 class Unit(BaseTest): 100 46 def run(self): 101 47 #capturing the stderr … … 119 65 return "[FAIL] Unit tests - report in indicop/report/pyunit.txt\n" 120 66 121 class Functional( Indicop):67 class Functional(BaseTest): 122 68 def run(self): 123 69 try: … … 176 122 return report 177 123 178 class Pylint( Indicop):124 class Pylint(BaseTest): 179 125 def run(self): 180 126 statusOutput = commands.getstatusoutput("pylint --rcfile=%s %s" % … … 194 140 return "PY Lint - report in indicop/report/pylint.txt\n" 195 141 196 class Jsunit(Indicop): 142 class Coverage(BaseTest): 143 def start(self): 144 figleaf.start() 145 146 def stop(self): 147 figleaf.stop() 148 coverageOutput = figleaf.get_data().gather_files() 149 coverageDir = os.path.join(self.setupDir, 'report', 'pycoverage') 150 try: 151 figleaf.annotate_html.report_as_html(coverageOutput, 152 coverageDir, [], {}) 153 except IOError: 154 os.mkdir(coverageDir) 155 figleaf.annotate_html.report_as_html(coverageOutput, 156 coverageDir, [], {}) 157 return ("PY Unit Test - Report generated in " 158 "report/pycoverage/index.html\n") 159 160 class Jsunit(BaseTest): 197 161 def __init__(self, jsSpecify, jsCoverage): 198 162 self.coverage = jsCoverage … … 314 278 return coverageReport + report 315 279 316 class Jslint( Indicop):280 class Jslint(BaseTest): 317 281 def run(self): 318 282 #Folders which are going to be scanned. … … 352 316 self.writeReport("jslint", outputString) 353 317 return "JS Lint - report in indicop/report/jslint.txt\n" 354 318 319 320 class Indicop(object): 321 322 def __init__(self, jsspecify, jscoverage): 323 #variables for jsunit 324 self.jsSpecify = jsspecify 325 self.jsCoverage = jscoverage 326 327 #define the set of tests 328 self.testsDict = {'unit': Unit(), 329 'functional': Functional(), 330 'pylint': Pylint(), 331 'jsunit': Jsunit(self.jsSpecify, self.jsCoverage), 332 'jslint': Jslint()} 333 334 335 def main(self, specify, coverage, testsToRun): 336 337 returnString = "\n\n=============== ~INDICOP SAYS~ ===============\n\n" 338 339 coverageTest = Coverage() 340 if coverage: 341 coverageTest.start() 342 343 344 #specified test can either be unit or functional. 345 #It makes more sense to run it here. 346 if specify: 347 #running directly the test here and ouputing in the console 348 result = nose.run(argv=['nose', '-v', os.path.join(self.setupDir, 349 'python', 350 specify)]) 351 if result: 352 returnString += "Specified Test - Succeeded\n" 353 else: 354 returnString += "[FAIL] Specified Test - \ 355 read output from console\n" 356 else: 357 for test in testsToRun: 358 try: 359 returnString += self.testsDict[test].run() 360 except KeyError: 361 returnString += ("[ERR] Test %s does not exist. " 362 "It has to be added in the testsDict variable\n") % test 363 364 365 if coverage: 366 returnString += coverageTest.stop() 367 368 return returnString 369 -
indicop/python/pylint/pylint.conf
r3636c5 rfbfc3b 309 309 310 310 # Maximum number of characters on a single line. 311 max-line-length= 79311 max-line-length=85 312 312 313 313 # Maximum number of lines in a module -
setup.py
r3636c5 rfbfc3b 346 346 testsToRun.append('jslint') 347 347 348 result = Indicop().main(self.specify, self.coverage, self.jsspecify, self.jscoverage, testsToRun) 348 indicop = Indicop(self.jsspecify, self.jscoverage) 349 result = indicop.main(self.specify, self.coverage, testsToRun) 349 350 print result 350 351
Note: See TracChangeset
for help on using the changeset viewer.
