For whatever reason, a few nodedev-related test cases
have ended up in test_connect instead of the more
appropriate test_nodedev. Move them.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
tests/test_connect.py | 27 ---------------------------
tests/test_nodedev.py | 26 ++++++++++++++++++++++++++
2 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/tests/test_connect.py b/tests/test_connect.py
index f481356..9cc51db 100755
--- a/tests/test_connect.py
+++ b/tests/test_connect.py
@@ -161,19 +161,6 @@ class TestConnect(libvirttest.BaseTestClass):
self.main_loop()
- @pytest.mark.usefixtures("node_device_create")
- @pytest.mark.parametrize("lookup_method_name,lookup_item", [
- ("NodeDeviceLookupByName", 'Name'),
- ])
- def test_connect_node_device_lookup_by_property(self, lookup_method_name, lookup_item, node_device_create):
- """Parameterized test for all NodeDeviceLookupBy* API calls of Connect interface
- """
- original_path = node_device_create
- obj = self.bus.get_object('org.libvirt', original_path)
- prop = obj.Get('org.libvirt.NodeDevice', lookup_item, dbus_interface=dbus.PROPERTIES_IFACE)
- path = getattr(self.connect, lookup_method_name)(prop)
- assert original_path == path
-
@pytest.mark.parametrize("lookup_method_name,lookup_item", [
("NetworkLookupByName", 'Name'),
("NetworkLookupByUUID", 'UUID'),
@@ -186,20 +173,6 @@ class TestConnect(libvirttest.BaseTestClass):
path = getattr(self.connect, lookup_method_name)(prop)
assert original_path == path
- def test_connect_node_device_create_xml(self):
- def node_device_created(path, event, _detail):
- if event != libvirttest.NodeDeviceEvent.CREATED:
- return
- assert isinstance(path, dbus.ObjectPath)
- self.loop.quit()
-
- self.connect.connect_to_signal('NodeDeviceEvent', node_device_created)
-
- path = self.connect.NodeDeviceCreateXML(xmldata.minimal_node_device_xml, 0)
- assert isinstance(path, dbus.ObjectPath)
-
- self.main_loop()
-
def test_connect_node_get_cpu_stats(self):
stats = self.connect.NodeGetCPUStats(0, 0)
assert isinstance(stats, dbus.Dictionary)
diff --git a/tests/test_nodedev.py b/tests/test_nodedev.py
index 082cf0b..c68cb66 100755
--- a/tests/test_nodedev.py
+++ b/tests/test_nodedev.py
@@ -3,11 +3,37 @@
import dbus
import libvirttest
import pytest
+import xmldata
class TestNodeDevice(libvirttest.BaseTestClass):
""" Tests for methods and properties of the NodeDevice interface
"""
+ @pytest.mark.parametrize("lookup_method_name,lookup_item", [
+ ("NodeDeviceLookupByName", 'Name'),
+ ])
+ def test_connect_node_device_lookup_by_property(self, lookup_method_name, lookup_item, node_device_create):
+ """Parameterized test for all NodeDeviceLookupBy* API calls of Connect interface
+ """
+ original_path = node_device_create
+ obj = self.bus.get_object('org.libvirt', original_path)
+ prop = obj.Get('org.libvirt.NodeDevice', lookup_item, dbus_interface=dbus.PROPERTIES_IFACE)
+ path = getattr(self.connect, lookup_method_name)(prop)
+ assert original_path == path
+
+ def test_connect_node_device_create(self):
+ def node_device_created(path, event, _detail):
+ if event != libvirttest.NodeDeviceEvent.CREATED:
+ return
+ assert isinstance(path, dbus.ObjectPath)
+ self.loop.quit()
+
+ self.connect.connect_to_signal('NodeDeviceEvent', node_device_created)
+
+ path = self.connect.NodeDeviceCreateXML(xmldata.minimal_node_device_xml, 0)
+ assert isinstance(path, dbus.ObjectPath)
+
+ self.main_loop()
def test_node_device_destroy(self, node_device_create):
def node_device_deleted(path, event, _detail):
--
2.17.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Fri, Jul 27, 2018 at 02:37:39PM +0200, Andrea Bolognani wrote: > For whatever reason, a few nodedev-related test cases > have ended up in test_connect instead of the more > appropriate test_nodedev. Move them. > > Signed-off-by: Andrea Bolognani <abologna@redhat.com> > --- https://www.redhat.com/mailman/listinfo/libvir-list Currently a test for some method is placed in the test file refering to the interface the tested method is exposed on. So NodeDeviceCreateXML method is exposed on the Connect Interface, this test_connect.py is the place for the test for this method. Katerina -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.