improved on test scripts to support individual parser options

This commit is contained in:
Martin Diehl 2014-06-11 17:46:26 +00:00
parent 0ca7f01186
commit 25459823ee
1 changed files with 4 additions and 10 deletions

View File

@ -39,15 +39,9 @@ class Test():
+'----------------------------------------------------------------') +'----------------------------------------------------------------')
self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__)) self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__))
self.parser = OptionParser( self.parser = OptionParser(
description = 'Using: $Id run_test.py 1285 2012-02-09 08:54:09Z MPIE\m.diehl $', description = test_description+' (using class: $Id run_test.py 1285 2012-02-09 08:54:09Z MPIE\m.diehl $)',
usage='./test.py [options]') usage='./test.py [options]')
self.updateRequested = False
self.parser.add_option("-u", "--update", action="store_true",\
dest="update",\
help="use current test results as new reference")
self.parser.set_defaults(update = False)
(self.options, self.args) = self.parser.parse_args()
def execute(self): def execute(self):
''' '''
@ -61,7 +55,7 @@ class Test():
self.prepare(variant) self.prepare(variant)
self.run(variant) self.run(variant)
self.postprocess(variant) self.postprocess(variant)
if self.options.update: # update requested if self.updateRequested: # update requested
self.update(variant) self.update(variant)
elif not self.compare(variant): # no update, do comparison elif not self.compare(variant): # no update, do comparison
return variant+1 # return culprit return variant+1 # return culprit