From 25f310ab03c3010d89b0cafa989aeab94bcda58f Mon Sep 17 00:00:00 2001 From: nima Date: Mon, 22 Dec 2008 13:37:43 +0000 Subject: Cleaned up the fix for type(127). Added the second type of stuffed bios (upstream). Integrated dmidecode the binary into the test case for a more objective result. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@163 abc39116-655e-4be6-ad55-d661dc543056 --- examples/test.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/test.py b/examples/test.py index 699a0bf..79f11d3 100755 --- a/examples/test.py +++ b/examples/test.py @@ -3,6 +3,11 @@ from pprint import pprint import os, sys, random, tempfile, time +import commands + +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) @@ -93,7 +98,11 @@ try: for i in types: sys.stdout.write(" * Testing type %i..."%i); sys.stdout.flush() output = dmidecode.type(i) - test(output is not False) + 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()) -- cgit