parent
9d3d492214
commit
8af9881e9b
@ -107,25 +107,33 @@ def run(names, outputDir, verbose=False):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
tally = Tally()
|
tally = Tally()
|
||||||
for test in names:
|
|
||||||
module = 'spack.test.' + test
|
|
||||||
print(module)
|
|
||||||
|
|
||||||
tty.msg("Running test: %s" % test)
|
modules = ['spack.test.' + test for test in names]
|
||||||
|
runOpts = ["--with-%s" % spack.test.tally_plugin.Tally.name]
|
||||||
|
|
||||||
runOpts = ["--with-%s" % spack.test.tally_plugin.Tally.name]
|
if outputDir:
|
||||||
|
xmlOutputFname = "unittests-{0}.xml".format(test)
|
||||||
if outputDir:
|
xmlOutputPath = join_path(outputDir, xmlOutputFname)
|
||||||
xmlOutputFname = "unittests-{0}.xml".format(test)
|
runOpts += ["--with-xunit",
|
||||||
xmlOutputPath = join_path(outputDir, xmlOutputFname)
|
"--xunit-file={0}".format(xmlOutputPath)]
|
||||||
runOpts += ["--with-xunit",
|
argv = [""] + runOpts + modules
|
||||||
"--xunit-file={0}".format(xmlOutputPath)]
|
nose.run(argv=argv, addplugins=[tally])
|
||||||
argv = [""] + runOpts + [module]
|
|
||||||
nose.run(argv=argv, addplugins=[tally])
|
|
||||||
|
|
||||||
succeeded = not tally.failCount and not tally.errorCount
|
succeeded = not tally.failCount and not tally.errorCount
|
||||||
tty.msg("Tests Complete.", "%5d tests run" % tally.numberOfTestsRun,
|
tty.msg(
|
||||||
"%5d failures" % tally.failCount, "%5d errors" % tally.errorCount)
|
"Tests Complete.",
|
||||||
|
"%5d tests run" % tally.numberOfTestsRun,
|
||||||
|
"%5d failures" % tally.failCount,
|
||||||
|
"%5d errors" % tally.errorCount
|
||||||
|
)
|
||||||
|
|
||||||
|
if tally.fail_list:
|
||||||
|
items = [x for x in tally.fail_list]
|
||||||
|
tty.msg('List of failing tests:', *items)
|
||||||
|
|
||||||
|
if tally.error_list:
|
||||||
|
items = [x for x in tally.error_list]
|
||||||
|
tty.msg('List of tests with errors:', *items)
|
||||||
|
|
||||||
if succeeded:
|
if succeeded:
|
||||||
tty.info("OK", format='g')
|
tty.info("OK", format='g')
|
||||||
|
@ -35,6 +35,8 @@ def __init__(self):
|
|||||||
self.successCount = 0
|
self.successCount = 0
|
||||||
self.failCount = 0
|
self.failCount = 0
|
||||||
self.errorCount = 0
|
self.errorCount = 0
|
||||||
|
self.error_list = []
|
||||||
|
self.fail_list = []
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def numberOfTestsRun(self):
|
def numberOfTestsRun(self):
|
||||||
@ -52,9 +54,11 @@ def addSuccess(self, test):
|
|||||||
|
|
||||||
def addError(self, test, err):
|
def addError(self, test, err):
|
||||||
self.errorCount += 1
|
self.errorCount += 1
|
||||||
|
self.error_list.append(test)
|
||||||
|
|
||||||
def addFailure(self, test, err):
|
def addFailure(self, test, err):
|
||||||
self.failCount += 1
|
self.failCount += 1
|
||||||
|
self.fail_list.append(test)
|
||||||
|
|
||||||
def finalize(self, result):
|
def finalize(self, result):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user