update function was not working due to name clash for self.update

This commit is contained in:
Martin Diehl 2016-09-10 20:44:46 +02:00
parent ee322be870
commit 0b4e75c201
1 changed files with 11 additions and 11 deletions

View File

@ -20,18 +20,18 @@ class Test():
def __init__(self, **kwargs): def __init__(self, **kwargs):
defaults = {'description': '', defaults = {'description': '',
'keep': False, 'keep': False,
'accept': False, 'accept': False,
'update': False, 'updateRequest': False,
} }
for arg in defaults.keys(): for arg in defaults.keys():
setattr(self,arg,kwargs.get(arg) if kwargs.get(arg) else defaults[arg]) setattr(self,arg,kwargs.get(arg) if kwargs.get(arg) else defaults[arg])
fh = logging.FileHandler('test.log') # create file handler which logs even debug messages fh = logging.FileHandler('test.log') # create file handler which logs even debug messages
fh.setLevel(logging.DEBUG) fh.setLevel(logging.DEBUG)
fh.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s: \n%(message)s')) fh.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s: \n%(message)s'))
ch = logging.StreamHandler(stream=sys.stdout) # create console handler with a higher log level ch = logging.StreamHandler(stream=sys.stdout) # create console handler with a higher log level
ch.setLevel(logging.INFO) ch.setLevel(logging.INFO)
ch.setFormatter(logging.Formatter('%(message)s')) ch.setFormatter(logging.Formatter('%(message)s'))
@ -61,7 +61,7 @@ class Test():
self.parser.set_defaults(keep = self.keep, self.parser.set_defaults(keep = self.keep,
accept = self.accept, accept = self.accept,
update = self.update, update = self.updateRequest,
) )
@ -80,10 +80,10 @@ class Test():
self.postprocess(variant) self.postprocess(variant)
if self.options.update and not self.update(variant): if self.options.update:
logging.critical('update for "{}" failed.'.format(name)) if self.update(variant) != 0: logging.critical('update for "{}" failed.'.format(name))
elif not (self.options.accept or self.compare(variant)): # no update, do comparison elif not (self.options.accept or self.compare(variant)): # no update, do comparison
return variant+1 # return culprit return variant+1 # return culprit
except Exception as e : except Exception as e :
logging.critical('exception during variant execution: {}'.format(e)) logging.critical('exception during variant execution: {}'.format(e))
@ -135,7 +135,7 @@ class Test():
def update(self,variant): def update(self,variant):
"""Update reference with current results.""" """Update reference with current results."""
logging.critical('update not supported.') logging.critical('update not supported.')
return False return 1
def dirReference(self): def dirReference(self):