From de2fa9f2628c95470a98703a7679e48447ca0e8a Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Thu, 10 Dec 2009 20:11:54 +0100 Subject: Make the unit test run without installing python-dmidecode Load the newly compiled module from the python build dir and use the local pymap.xml file. --- unit-tests/unit | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'unit-tests') diff --git a/unit-tests/unit b/unit-tests/unit index 1dd9c61..dbb1e2e 100755 --- a/unit-tests/unit +++ b/unit-tests/unit @@ -5,6 +5,11 @@ from pprint import pprint import os, sys, random, tempfile, time import commands +# Setup temporary sys.path() with our build dir +(sysname, nodename, release, version, machine) = os.uname() +pyver = sys.version[:3] +sys.path.insert(0,'../build/lib.%s-%s-%s' % (sysname.lower(), machine, pyver)) + root_user = (os.getuid() == 0 and True or False) DUMPS_D = "private" @@ -130,7 +135,15 @@ try: if root_user: devices.append("/dev/mem") else: - sys.stdout.write(" * %s\n"%red("Running test as normal user, will not try to read /dev/mem\n")) + sys.stdout.write(" * %s\n"%red("Running test as normal user, will not try to read /dev/mem")) + + try: + pymap = '../src/pymap.xml' + sys.stdout.write(" * Loading %s for XML->Python dictonary mapping..." % pymap) + dmidecode.pythonmap(pymap) + passed() + except: + failed() random.shuffle(types) random.shuffle(devices) @@ -181,6 +194,7 @@ try: except LookupError, e: failed(e, 2) + dmixml = dmidecode.dmidecodeXML() try: sys.stdout.write(" * XML: Swapping result type dmidecodeXML::SetResultType('-')..."); -- cgit