Commit eaded7bd authored by Daniel P. Berrange's avatar Daniel P. Berrange

Add support for running unit tests with nose

Make the 'python setup.py test' able to run unit tests
found under tests/ through the 'nosetests' command
Signed-off-by: 's avatarDaniel P. Berrange <berrange@redhat.com>
parent 69c4600d
......@@ -267,7 +267,12 @@ class my_test(Command):
apis = get_api_xml_files()
if "PYTHONPATH" in os.environ:
os.environ["PYTHONPATH"] = self.build_platlib + ":" + os.environ["PYTHONPATH"]
else:
os.environ["PYTHONPATH"] = self.build_platlib
self.spawn([sys.executable, "sanitytest.py", self.build_platlib, apis[0]])
self.spawn(["nosetests"])
class my_clean(clean):
......
import unittest
import libvirt
class TestLibvirtConn(unittest.TestCase):
def setUp(self):
self.conn = libvirt.open("test:///default")
def tearDown(self):
self.conn = None
def testConnDomainList(self):
doms = self.conn.listAllDomains()
self.assertEquals(len(doms), 1)
self.assertEquals(type(doms[0]), libvirt.virDomain)
self.assertEquals(doms[0].name(), "test")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment