if killed:
self.result = 'KILLED'
Result.runresults['KILLED'] += 1
- elif self.returncode is 0:
+ elif self.returncode == 0:
self.result = 'PASS'
Result.runresults['PASS'] += 1
- elif self.returncode is 4:
+ elif self.returncode == 4:
self.result = 'SKIP'
Result.runresults['SKIP'] += 1
- elif self.returncode is not 0:
+ elif self.returncode != 0:
self.result = 'FAIL'
Result.runresults['FAIL'] += 1
write_log(bytearray(result_line, encoding='utf-8'), LOG_FILE)
if not options.quiet:
write_log(result_line, LOG_OUT)
- elif options.quiet and self.result.result is not 'PASS':
+ elif options.quiet and self.result.result != 'PASS':
write_log(result_line, LOG_OUT)
lines = sorted(self.result.stdout + self.result.stderr,
cont = True
if len(pretest.pathname):
pretest.run(options)
- cont = pretest.result.result is 'PASS'
+ cont = pretest.result.result == 'PASS'
pretest.log(options)
if cont:
"because it failed verification.\n" %
(test, self.pathname), LOG_ERR)
- return len(self.tests) is not 0
+ return len(self.tests) != 0
def run(self, options):
"""
cont = True
if len(pretest.pathname):
pretest.run(options)
- cont = pretest.result.result is 'PASS'
+ cont = pretest.result.result == 'PASS'
pretest.log(options)
for fname in self.tests:
for prop in TestGroup.props:
for sect in ['DEFAULT', section]:
if config.has_option(sect, prop):
- if prop is "tags":
+ if prop == "tags":
setattr(testgroup, prop,
eval(config.get(sect, prop)))
else:
return
global LOG_FILE_OBJ
- if options.cmd is not 'wrconfig':
+ if options.cmd != 'wrconfig':
try:
old = os.umask(0)
os.makedirs(self.outputdir, mode=0o777)
iteration += 1
def summary(self):
- if Result.total is 0:
+ if Result.total == 0:
return 2
print('\nResults Summary')
for key in list(Result.runresults.keys()):
- if Result.runresults[key] is not 0:
+ if Result.runresults[key] != 0:
print('%s\t% 4d' % (key, Result.runresults[key]))
m, s = divmod(time() - self.starttime, 60)
p = Popen(testcmd)
p.wait()
- if p.returncode is not 0:
+ if p.returncode != 0:
write_log("Warning: user '%s' cannot use passwordless sudo.\n" % user,
LOG_ERR)
return False
def options_cb(option, opt_str, value, parser):
path_options = ['runfile', 'outputdir', 'template', 'testdir']
- if option.dest is 'runfile' and '-w' in parser.rargs or \
- option.dest is 'template' and '-c' in parser.rargs:
+ if option.dest == 'runfile' and '-w' in parser.rargs or \
+ option.dest == 'template' and '-c' in parser.rargs:
fail('-c and -w are mutually exclusive.')
if opt_str in parser.rargs:
fail('%s may only be specified once.' % opt_str)
- if option.dest is 'runfile':
+ if option.dest == 'runfile':
parser.values.cmd = 'rdconfig'
- if option.dest is 'template':
+ if option.dest == 'template':
parser.values.cmd = 'wrconfig'
- if option.dest is 'tags':
+ if option.dest == 'tags':
value = [x.strip() for x in value.split(',')]
setattr(parser.values, option.dest, value)
options = parse_args()
testrun = TestRun(options)
- if options.cmd is 'runtests':
+ if options.cmd == 'runtests':
find_tests(testrun, options)
- elif options.cmd is 'rdconfig':
+ elif options.cmd == 'rdconfig':
testrun.read(options)
- elif options.cmd is 'wrconfig':
+ elif options.cmd == 'wrconfig':
find_tests(testrun, options)
testrun.write(options)
exit(0)