From eaded7bdadf3ccdc4b208ec0ed65a1b23b8b5f69 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 18 Mar 2014 11:11:48 +0000 Subject: 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: Daniel P. Berrange --- tests/test_conn.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/test_conn.py (limited to 'tests') diff --git a/tests/test_conn.py b/tests/test_conn.py new file mode 100644 index 0000000..9fee099 --- /dev/null +++ b/tests/test_conn.py @@ -0,0 +1,16 @@ + +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") -- cgit v1.2.1