From a18a72fab2a622077d5257003b09be30ab283339 Mon Sep 17 00:00:00 2001 From: Nima Talebi Date: Sat, 23 May 2009 14:37:01 +1000 Subject: More cleanup Don't write to stdout unless in debug mode (with respect to writing to memory devices. Added the xml datafile to setup (distutils). Updated test case (incorporating color and cleaning up tests). --- examples/test.py | 83 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 29 deletions(-) (limited to 'examples/test.py') diff --git a/examples/test.py b/examples/test.py index 79f11d3..c645d02 100755 --- a/examples/test.py +++ b/examples/test.py @@ -5,6 +5,29 @@ from pprint import pprint import os, sys, random, tempfile, time import commands +DUMPS_D = "../../pydmidata/" + +def ascii(s, i): return "\033[%d;1m%s\033[0m"%(30+i, str(s)) +def black(s): return "\033[30;1m%s\033[0m"%(str(s)) +def red(s): return "\033[31;1m%s\033[0m"%(str(s)) +def green(s): return "\033[32;1m%s\033[0m"%(str(s)) +def yellow(s): return "\033[33;1m%s\033[0m"%(str(s)) +def blue(s): return "\033[34;1m%s\033[0m"%(str(s)) +def magenta(s): return "\033[35;1m%s\033[0m"%(str(s)) +def cyan(s): return "\033[36;1m%s\033[0m"%(str(s)) +def white(s): return "\033[37;1m%s\033[0m"%(str(s)) + +DISPATCH = { + 1 : red, + 2 : green, + 3 : yellow, + 4 : blue, + 5 : magenta, + 6 : cyan, + 7 : white, +} + +LINE = "%s\n"%(magenta("="*80)) dmidecode = True in [os.path.exists(os.path.join(_, "dmidecode")) for _ in os.getenv("PATH").split(':')] if dmidecode: print "Please install `dmidecode' (the binary) for complete testing." @@ -22,40 +45,40 @@ def test(r): total += 1 if r: - sys.stdout.write("Good\n") + sys.stdout.write("%s\n"%green("PASS")) success += 1 return True else: - sys.stdout.write("FAILED\n") + sys.stdout.write("%s\n"%red("FAIL")) return False total += 1 -print "-"*80 -sys.stdout.write("Importing module...") +sys.stdout.write(LINE) +sys.stdout.write(" * Importing module...") try: import dmidecode success += 1 - sys.stdout.write("Done\n") - sys.stdout.write(" * Version: %s\n"%dmidecode.version) - sys.stdout.write(" * DMI Version String: %s\n"%dmidecode.dmi) + sys.stdout.write("%s\n"%green("PASS")) + sys.stdout.write(" * Version: %s\n"%blue(dmidecode.version)) + sys.stdout.write(" * DMI Version String: %s\n"%blue(dmidecode.dmi)) print "-"*80 - sys.stdout.write("Testing that default device is /dev/mem...") + sys.stdout.write(" * Testing that default device is /dev/mem...") test(dmidecode.get_dev() == "/dev/mem") - sys.stdout.write("Testing that write-lock will not break on dump()...") + sys.stdout.write(" * Testing that write-lock will not break on dump()...") test(not dmidecode.dump()) - sys.stdout.write("Testing ability to change device to %s..."%DUMP) + sys.stdout.write(" * Testing ability to change device to %s..."%DUMP) test(dmidecode.set_dev(DUMP)) - sys.stdout.write("Testing that device has changed to %s..."%DUMP) + sys.stdout.write(" * Testing that device has changed to %s..."%DUMP) test(dmidecode.get_dev() == DUMP) - sys.stdout.write("Testing that write on new file is ok...") + sys.stdout.write(" * Testing that write on new file is ok...") test(dmidecode.dump()) - sys.stdout.write("Testing that file was actually written...") + sys.stdout.write(" * Testing that file was actually written...") time.sleep(0.1) test(os.path.exists(DUMP)) os.unlink(DUMP) @@ -64,39 +87,39 @@ try: bad_types = [-1, -1000, 256] sections = ["bios", "system", "baseboard", "chassis", "processor", "memory", "cache", "connector", "slot"] devices = [] - if os.path.exists("private"): - devices.extend([os.path.join("private", _) for _ in os.listdir("private")]) - devices.remove('private/.svn') + if os.path.exists(DUMPS_D): + devices.extend([os.path.join(DUMPS_D, _) for _ in os.listdir(DUMPS_D)]) else: - sys.stdout.write("If you have memory dumps to test, create a directory called `private' and drop them in there.\n") + sys.stdout.write(" * If you have memory dumps to test, create a directory called `%s' and drop them in there.\n"%(DUMPS_D)) devices.append("/dev/mem") random.shuffle(types) random.shuffle(devices) random.shuffle(sections) for dev in devices: - sys.stdout.write(" * Testing %s..."%dev); sys.stdout.flush() + sys.stdout.write(" * Testing %s..."%yellow(dev)); sys.stdout.flush() if test(dmidecode.set_dev(dev) and dmidecode.get_dev() == dev): - print "-"*80 - print sections + sys.stdout.write(LINE) + i = 0 for section in sections: - sys.stdout.write(" * Testing %s..."%section); sys.stdout.flush() + i += 0 + sys.stdout.write(" * Testing %s (%s/%d)..."%cyan(section), i, len(sections)); sys.stdout.flush() output = getattr(dmidecode, section)() test(output is not False) - if output: sys.stdout.write(" * %s\n"%output.keys()) + if output: sys.stdout.write(" * %s\n"%black(output.keys())) - print "-"*80 + sys.stdout.write(LINE) for i in bad_types: - sys.stdout.write(" * Testing bad type %i..."%i); sys.stdout.flush() + sys.stdout.write(" * Testing bad type %s..."%red(i)); sys.stdout.flush() try: output = dmidecode.type(i) test(output is False) except SystemError: - sys.stdout.write("FAILED\n") + sys.stdout.write("%s\n"%red("FAIL")) - print "-"*80 + sys.stdout.write(LINE) for i in types: - sys.stdout.write(" * Testing type %i..."%i); sys.stdout.flush() + sys.stdout.write(" * Testing type %s..."%red(i)); sys.stdout.flush() output = dmidecode.type(i) if dmidecode: _output = commands.getoutput("dmidecode -t %d"%i).strip().split('\n') @@ -107,6 +130,8 @@ try: sys.stdout.write(" * %s\n"%output.keys()) except ImportError: - sys.stdout.write("FAILED\n") + sys.stdout.write("%s\n"%red("FAIL")) -sys.stdout.write("Score: %d/%d\n"%(success, total)) +color = red +if success == total: color = green +sys.stdout.write("Score: %s/%s\n"%(color(success), color(total))) -- cgit From f17fca75b0766caeba992bd62ab9c87cc6a79acc Mon Sep 17 00:00:00 2001 From: Nima Talebi Date: Sat, 23 May 2009 15:21:42 +1000 Subject: Completed test case Removed trailing spaces from xml data file. Commented out fprintf()s for now (Perhapse should add them to the debug build at least). --- examples/test.py | 65 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 27 deletions(-) (limited to 'examples/test.py') diff --git a/examples/test.py b/examples/test.py index c645d02..053d81d 100755 --- a/examples/test.py +++ b/examples/test.py @@ -5,7 +5,7 @@ from pprint import pprint import os, sys, random, tempfile, time import commands -DUMPS_D = "../../pydmidata/" +DUMPS_D = "private" def ascii(s, i): return "\033[%d;1m%s\033[0m"%(30+i, str(s)) def black(s): return "\033[30;1m%s\033[0m"%(str(s)) @@ -39,17 +39,22 @@ os.close(FH) total = 0 success = 0 -def test(r): +def passed(): global total global success - total += 1 + success += 1 + sys.stdout.write("%s\n"%green("PASS")) +def failed(): + global total + total += 1 + sys.stdout.write("%s\n"%red("FAIL")) +def test(r): if r: - sys.stdout.write("%s\n"%green("PASS")) - success += 1 + passed() return True else: - sys.stdout.write("%s\n"%red("FAIL")) + failed() return False total += 1 @@ -58,7 +63,7 @@ sys.stdout.write(" * Importing module...") try: import dmidecode success += 1 - sys.stdout.write("%s\n"%green("PASS")) + passed() sys.stdout.write(" * Version: %s\n"%blue(dmidecode.version)) sys.stdout.write(" * DMI Version String: %s\n"%blue(dmidecode.dmi)) @@ -80,8 +85,8 @@ try: sys.stdout.write(" * Testing that file was actually written...") time.sleep(0.1) - test(os.path.exists(DUMP)) - os.unlink(DUMP) + if test(os.path.exists(DUMP)): + os.unlink(DUMP) types = range(0, 42)+range(126, 128) bad_types = [-1, -1000, 256] @@ -97,40 +102,46 @@ try: random.shuffle(sections) for dev in devices: + sys.stdout.write(LINE) sys.stdout.write(" * Testing %s..."%yellow(dev)); sys.stdout.flush() if test(dmidecode.set_dev(dev) and dmidecode.get_dev() == dev): - sys.stdout.write(LINE) i = 0 for section in sections: - i += 0 - sys.stdout.write(" * Testing %s (%s/%d)..."%cyan(section), i, len(sections)); sys.stdout.flush() - output = getattr(dmidecode, section)() - test(output is not False) - if output: sys.stdout.write(" * %s\n"%black(output.keys())) + i += 1 + sys.stdout.write(" * Testing %s (%d/%d)..."%(cyan(section), i, len(sections))); sys.stdout.flush() + try: + output = getattr(dmidecode, section)() + test(output is not False) + if output: + sys.stdout.write(" * %s\n"%black(output.keys())) + except LookupError, e: + failed() + sys.stdout.write(" x %s\n"%red(e)) - sys.stdout.write(LINE) for i in bad_types: sys.stdout.write(" * Testing bad type %s..."%red(i)); sys.stdout.flush() try: output = dmidecode.type(i) test(output is False) except SystemError: - sys.stdout.write("%s\n"%red("FAIL")) + failed() - sys.stdout.write(LINE) for i in types: sys.stdout.write(" * Testing type %s..."%red(i)); sys.stdout.flush() - output = dmidecode.type(i) - if dmidecode: - _output = commands.getoutput("dmidecode -t %d"%i).strip().split('\n') - test(len(_output) == 1 and len(output) == 0 or True) - else: - test(output is not False) - if output: - sys.stdout.write(" * %s\n"%output.keys()) + try: + output = dmidecode.type(i) + if dmidecode: + _output = commands.getoutput("dmidecode -t %d"%i).strip().split('\n') + test(len(_output) == 1 and len(output) == 0 or True) + else: + test(output is not False) + if output: + sys.stdout.write(" * %s\n"%output.keys()) + except: + failed() except ImportError: - sys.stdout.write("%s\n"%red("FAIL")) + failed() color = red if success == total: color = green -- cgit From 3c0d0ba3b8f3607f3da8f38d5447a6b38cb5ee8d Mon Sep 17 00:00:00 2001 From: Nima Talebi Date: Sat, 23 May 2009 15:57:50 +1000 Subject: More work on test case --- examples/test.py | 79 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 30 deletions(-) (limited to 'examples/test.py') diff --git a/examples/test.py b/examples/test.py index 053d81d..3a86c9c 100755 --- a/examples/test.py +++ b/examples/test.py @@ -28,46 +28,62 @@ DISPATCH = { } LINE = "%s\n"%(magenta("="*80)) -dmidecode = True in [os.path.exists(os.path.join(_, "dmidecode")) for _ in os.getenv("PATH").split(':')] -if dmidecode: - print "Please install `dmidecode' (the binary) for complete testing." - -FH, DUMP = tempfile.mkstemp() -os.unlink(DUMP) -os.close(FH) - -total = 0 -success = 0 - -def passed(): - global total - global success - total += 1 - success += 1 + +score = { + "total" : 0, + "skipped" : 0, + "passed" : 0, + "failed" : 0, +} + +def passed(msg=None, indent=1): + global score + score["total"] += 1 + score["passed"] += 1 sys.stdout.write("%s\n"%green("PASS")) -def failed(): - global total - total += 1 + if msg: sys.stdout.write("%s %s %s\n"%(" "*indent, green("P"), msg)) +def skipped(msg=None, indent=1): + global score + score["total"] += 1 + score["skipped"] += 1 + sys.stdout.write("%s\n"%yellow("SKIP")) + if msg: sys.stdout.write("%s %s %s\n"%(" "*indent, yellow("S"), msg)) +def failed(msg=None, indent=1): + global score + score["total"] += 1 + score["failed"] += 1 sys.stdout.write("%s\n"%red("FAIL")) -def test(r): + if msg: sys.stdout.write("%s %s %s\n"%(" "*indent, red("F"), msg)) +def test(r, msg=None, indent=1): if r: - passed() + passed(msg, indent) return True else: - failed() + failed(msg, indent) return False -total += 1 +sys.stdout.write(LINE) +sys.stdout.write(" * Testing for access to /dev/mem...") +d = True in [os.path.exists(os.path.join(_, "dmidecode")) for _ in os.getenv("PATH").split(':')] +test(d, "Please install `dmidecode' (the binary) for complete testing.", 1) + +sys.stdout.write(" * Creation of temporary files...") +try: + FH, DUMP = tempfile.mkstemp() + os.unlink(DUMP) + os.close(FH) + passed() +except: + failed() + sys.stdout.write(LINE) sys.stdout.write(" * Importing module...") try: import dmidecode - success += 1 passed() sys.stdout.write(" * Version: %s\n"%blue(dmidecode.version)) sys.stdout.write(" * DMI Version String: %s\n"%blue(dmidecode.dmi)) - print "-"*80 sys.stdout.write(" * Testing that default device is /dev/mem...") test(dmidecode.get_dev() == "/dev/mem") @@ -115,8 +131,9 @@ try: if output: sys.stdout.write(" * %s\n"%black(output.keys())) except LookupError, e: - failed() - sys.stdout.write(" x %s\n"%red(e)) + failed(e, 2) + except IOError: + skipped("Permission denied", 2) for i in bad_types: sys.stdout.write(" * Testing bad type %s..."%red(i)); sys.stdout.flush() @@ -143,6 +160,8 @@ try: except ImportError: failed() -color = red -if success == total: color = green -sys.stdout.write("Score: %s/%s\n"%(color(success), color(total))) +sys.stdout.write(LINE) +sys.stdout.write("Total : %s\n"%blue(score["total"])) +sys.stdout.write("Skipped : %s\n"%yellow(score["skipped"])) +sys.stdout.write("Passed : %s\n"%green(score["passed"])) +sys.stdout.write("Failed : %s\n"%red(score["failed"])) -- cgit From cc76255fecfc9a4168debf1baccd68097d8f7c71 Mon Sep 17 00:00:00 2001 From: Nima Talebi Date: Sat, 23 May 2009 17:01:41 +1000 Subject: Cleanup of test case --- examples/test.py | 80 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 37 deletions(-) (limited to 'examples/test.py') diff --git a/examples/test.py b/examples/test.py index 3a86c9c..b3a7be7 100755 --- a/examples/test.py +++ b/examples/test.py @@ -63,9 +63,9 @@ def test(r, msg=None, indent=1): return False sys.stdout.write(LINE) -sys.stdout.write(" * Testing for access to /dev/mem...") +sys.stdout.write(" * Testing for dmidecode (upstream)...") d = True in [os.path.exists(os.path.join(_, "dmidecode")) for _ in os.getenv("PATH").split(':')] -test(d, "Please install `dmidecode' (the binary) for complete testing.", 1) +test(d) sys.stdout.write(" * Creation of temporary files...") try: @@ -120,47 +120,53 @@ try: for dev in devices: sys.stdout.write(LINE) sys.stdout.write(" * Testing %s..."%yellow(dev)); sys.stdout.flush() - if test(dmidecode.set_dev(dev) and dmidecode.get_dev() == dev): - i = 0 - for section in sections: - i += 1 - sys.stdout.write(" * Testing %s (%d/%d)..."%(cyan(section), i, len(sections))); sys.stdout.flush() - try: - output = getattr(dmidecode, section)() - test(output is not False) - if output: - sys.stdout.write(" * %s\n"%black(output.keys())) - except LookupError, e: - failed(e, 2) - except IOError: - skipped("Permission denied", 2) - - for i in bad_types: - sys.stdout.write(" * Testing bad type %s..."%red(i)); sys.stdout.flush() - try: - output = dmidecode.type(i) - test(output is False) - except SystemError: - failed() - - for i in types: - sys.stdout.write(" * Testing type %s..."%red(i)); sys.stdout.flush() - try: - output = dmidecode.type(i) - if dmidecode: - _output = commands.getoutput("dmidecode -t %d"%i).strip().split('\n') - test(len(_output) == 1 and len(output) == 0 or True) - else: + try: + fH = open(dev, 'r') + fH.close() + passed() + sys.stdout.write(" * Testing set_dev/get_dev on %s..."%(yellow(dev))); sys.stdout.flush() + if test(dmidecode.set_dev(dev) and dmidecode.get_dev() == dev): + i = 0 + for section in sections: + i += 1 + sys.stdout.write(" * Testing %s (%d/%d)..."%(cyan(section), i, len(sections))); sys.stdout.flush() + try: + output = getattr(dmidecode, section)() test(output is not False) - if output: - sys.stdout.write(" * %s\n"%output.keys()) - except: - failed() + if output: + sys.stdout.write(" * %s\n"%black(output.keys())) + except LookupError, e: + failed(e, 2) + + for i in bad_types: + sys.stdout.write(" * Testing bad type %s..."%red(i)); sys.stdout.flush() + try: + output = dmidecode.type(i) + test(output is False) + except SystemError: + failed() + + for i in types: + sys.stdout.write(" * Testing type %s..."%red(i)); sys.stdout.flush() + try: + output = dmidecode.type(i) + if dmidecode: + _output = commands.getoutput("dmidecode -t %d"%i).strip().split('\n') + test(len(_output) == 1 and len(output) == 0 or True) + else: + test(output is not False) + if output: + sys.stdout.write(" * %s\n"%output.keys()) + except IOError, e: + failed(e, 2) + except IOError: + skipped() except ImportError: failed() sys.stdout.write(LINE) +sys.stdout.write("Devices : %s\n"%cyan(len(devices))) sys.stdout.write("Total : %s\n"%blue(score["total"])) sys.stdout.write("Skipped : %s\n"%yellow(score["skipped"])) sys.stdout.write("Passed : %s\n"%green(score["passed"])) -- cgit From 717ff3b75bca054a7f14de43a6ef6fc0535d3953 Mon Sep 17 00:00:00 2001 From: Nima Talebi Date: Sat, 23 May 2009 18:39:30 +1000 Subject: Expanding the test case to include the POC demo The POC demo does not actually do much testing yet, other than just working or not working - but it's in place now for future enhancements. --- examples/test.py | 173 ------------------------------------------------------- 1 file changed, 173 deletions(-) delete mode 100755 examples/test.py (limited to 'examples/test.py') diff --git a/examples/test.py b/examples/test.py deleted file mode 100755 index b3a7be7..0000000 --- a/examples/test.py +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/env python -#.awk '$0 ~ /case [0-9]+: .. 3/ { sys.stdout.write($2 }' src/dmidecode.c|tr ':\n' ', ' - -from pprint import pprint -import os, sys, random, tempfile, time -import commands - -DUMPS_D = "private" - -def ascii(s, i): return "\033[%d;1m%s\033[0m"%(30+i, str(s)) -def black(s): return "\033[30;1m%s\033[0m"%(str(s)) -def red(s): return "\033[31;1m%s\033[0m"%(str(s)) -def green(s): return "\033[32;1m%s\033[0m"%(str(s)) -def yellow(s): return "\033[33;1m%s\033[0m"%(str(s)) -def blue(s): return "\033[34;1m%s\033[0m"%(str(s)) -def magenta(s): return "\033[35;1m%s\033[0m"%(str(s)) -def cyan(s): return "\033[36;1m%s\033[0m"%(str(s)) -def white(s): return "\033[37;1m%s\033[0m"%(str(s)) - -DISPATCH = { - 1 : red, - 2 : green, - 3 : yellow, - 4 : blue, - 5 : magenta, - 6 : cyan, - 7 : white, -} - -LINE = "%s\n"%(magenta("="*80)) - -score = { - "total" : 0, - "skipped" : 0, - "passed" : 0, - "failed" : 0, -} - -def passed(msg=None, indent=1): - global score - score["total"] += 1 - score["passed"] += 1 - sys.stdout.write("%s\n"%green("PASS")) - if msg: sys.stdout.write("%s %s %s\n"%(" "*indent, green("P"), msg)) -def skipped(msg=None, indent=1): - global score - score["total"] += 1 - score["skipped"] += 1 - sys.stdout.write("%s\n"%yellow("SKIP")) - if msg: sys.stdout.write("%s %s %s\n"%(" "*indent, yellow("S"), msg)) -def failed(msg=None, indent=1): - global score - score["total"] += 1 - score["failed"] += 1 - sys.stdout.write("%s\n"%red("FAIL")) - if msg: sys.stdout.write("%s %s %s\n"%(" "*indent, red("F"), msg)) -def test(r, msg=None, indent=1): - if r: - passed(msg, indent) - return True - else: - failed(msg, indent) - return False - -sys.stdout.write(LINE) -sys.stdout.write(" * Testing for dmidecode (upstream)...") -d = True in [os.path.exists(os.path.join(_, "dmidecode")) for _ in os.getenv("PATH").split(':')] -test(d) - -sys.stdout.write(" * Creation of temporary files...") -try: - FH, DUMP = tempfile.mkstemp() - os.unlink(DUMP) - os.close(FH) - passed() -except: - failed() - -sys.stdout.write(LINE) -sys.stdout.write(" * Importing module...") -try: - import dmidecode - passed() - sys.stdout.write(" * Version: %s\n"%blue(dmidecode.version)) - sys.stdout.write(" * DMI Version String: %s\n"%blue(dmidecode.dmi)) - - sys.stdout.write(" * Testing that default device is /dev/mem...") - test(dmidecode.get_dev() == "/dev/mem") - - sys.stdout.write(" * Testing that write-lock will not break on dump()...") - test(not dmidecode.dump()) - - sys.stdout.write(" * Testing ability to change device to %s..."%DUMP) - test(dmidecode.set_dev(DUMP)) - - sys.stdout.write(" * Testing that device has changed to %s..."%DUMP) - test(dmidecode.get_dev() == DUMP) - - sys.stdout.write(" * Testing that write on new file is ok...") - test(dmidecode.dump()) - - sys.stdout.write(" * Testing that file was actually written...") - time.sleep(0.1) - if test(os.path.exists(DUMP)): - os.unlink(DUMP) - - types = range(0, 42)+range(126, 128) - bad_types = [-1, -1000, 256] - sections = ["bios", "system", "baseboard", "chassis", "processor", "memory", "cache", "connector", "slot"] - devices = [] - if os.path.exists(DUMPS_D): - devices.extend([os.path.join(DUMPS_D, _) for _ in os.listdir(DUMPS_D)]) - else: - sys.stdout.write(" * If you have memory dumps to test, create a directory called `%s' and drop them in there.\n"%(DUMPS_D)) - devices.append("/dev/mem") - random.shuffle(types) - random.shuffle(devices) - random.shuffle(sections) - - for dev in devices: - sys.stdout.write(LINE) - sys.stdout.write(" * Testing %s..."%yellow(dev)); sys.stdout.flush() - try: - fH = open(dev, 'r') - fH.close() - passed() - sys.stdout.write(" * Testing set_dev/get_dev on %s..."%(yellow(dev))); sys.stdout.flush() - if test(dmidecode.set_dev(dev) and dmidecode.get_dev() == dev): - i = 0 - for section in sections: - i += 1 - sys.stdout.write(" * Testing %s (%d/%d)..."%(cyan(section), i, len(sections))); sys.stdout.flush() - try: - output = getattr(dmidecode, section)() - test(output is not False) - if output: - sys.stdout.write(" * %s\n"%black(output.keys())) - except LookupError, e: - failed(e, 2) - - for i in bad_types: - sys.stdout.write(" * Testing bad type %s..."%red(i)); sys.stdout.flush() - try: - output = dmidecode.type(i) - test(output is False) - except SystemError: - failed() - - for i in types: - sys.stdout.write(" * Testing type %s..."%red(i)); sys.stdout.flush() - try: - output = dmidecode.type(i) - if dmidecode: - _output = commands.getoutput("dmidecode -t %d"%i).strip().split('\n') - test(len(_output) == 1 and len(output) == 0 or True) - else: - test(output is not False) - if output: - sys.stdout.write(" * %s\n"%output.keys()) - except IOError, e: - failed(e, 2) - except IOError: - skipped() - -except ImportError: - failed() - -sys.stdout.write(LINE) -sys.stdout.write("Devices : %s\n"%cyan(len(devices))) -sys.stdout.write("Total : %s\n"%blue(score["total"])) -sys.stdout.write("Skipped : %s\n"%yellow(score["skipped"])) -sys.stdout.write("Passed : %s\n"%green(score["passed"])) -sys.stdout.write("Failed : %s\n"%red(score["failed"])) -- cgit