summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authornima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-12-22 13:37:43 +0000
committernima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-12-22 13:37:43 +0000
commit25f310ab03c3010d89b0cafa989aeab94bcda58f (patch)
treeccd1b5462a13030e1d85c6162fce96959dab2bc0 /examples
parent915ed13f64903adda36446657d19e6bae02e3be2 (diff)
downloadpython-dmidecode-25f310ab03c3010d89b0cafa989aeab94bcda58f.tar.gz
python-dmidecode-25f310ab03c3010d89b0cafa989aeab94bcda58f.tar.xz
python-dmidecode-25f310ab03c3010d89b0cafa989aeab94bcda58f.zip
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
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/test.py11
1 files changed, 10 insertions, 1 deletions
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())