diff options
author | David Sommerseth <davids@redhat.com> | 2009-12-10 20:11:54 +0100 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2009-12-10 20:11:54 +0100 |
commit | de2fa9f2628c95470a98703a7679e48447ca0e8a (patch) | |
tree | 63bcd546fdecf5ced4ea2fba89af58e7b7a96d75 /unit-tests | |
parent | fc09629c0c19c7efdc5ef8781a775293b4ae9416 (diff) | |
download | python-dmidecode-de2fa9f2628c95470a98703a7679e48447ca0e8a.tar.gz python-dmidecode-de2fa9f2628c95470a98703a7679e48447ca0e8a.tar.xz python-dmidecode-de2fa9f2628c95470a98703a7679e48447ca0e8a.zip |
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.
Diffstat (limited to 'unit-tests')
-rwxr-xr-x | unit-tests/unit | 16 |
1 files changed, 15 insertions, 1 deletions
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('-')..."); |