added funtionality to run selected test only and functionality to show available tests

This commit is contained in:
Martin Diehl 2016-09-20 07:10:07 +02:00
parent 03aebdf958
commit e5ba508080
1 changed files with 28 additions and 13 deletions

View File

@ -23,6 +23,8 @@ class Test():
'keep': False, 'keep': False,
'accept': False, 'accept': False,
'updateRequest': False, 'updateRequest': False,
'show': False,
'select': None,
} }
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])
@ -58,10 +60,18 @@ class Test():
action = "store_true", action = "store_true",
dest = "accept", dest = "accept",
help = "calculate results but always consider test as successfull") help = "calculate results but always consider test as successfull")
self.parser.add_option("-l", "--list",
action = "store_true",
dest = "show",
help = "show all test variants and do no calculation")
self.parser.add_option("-s", "--select",
dest = "select",
help = "run test of given name only")
self.parser.set_defaults(keep = self.keep, self.parser.set_defaults(keep = self.keep,
accept = self.accept, accept = self.accept,
update = self.updateRequest, update = self.updateRequest,
show = self.show,
select = self.select,
) )
@ -73,6 +83,11 @@ class Test():
self.prepareAll() self.prepareAll()
for variant,name in enumerate(self.variants): for variant,name in enumerate(self.variants):
if self.options.show:
logging.critical('{}: {}'.format(variant,name))
elif self.options.select is not None and name != self.options.select:
pass
else:
try: try:
if not self.options.keep: if not self.options.keep:
self.prepare(variant) self.prepare(variant)