def _check_physical_function(self): if self.pci_address_spec.is_single_address(): self.is_physical_function = ( utils.is_physical_function( self.pci_address_spec.domain, self.pci_address_spec.bus, self.pci_address_spec.slot, self.pci_address_spec.func))
def _check_physical_function(self): if ANY in (self.domain, self.bus, self.slot, self.func): return self.is_physical_function = utils.is_physical_function( self.domain, self.bus, self.slot, self.func)
def test_exception(self, *args): self.assertFalse(utils.is_physical_function(*self.pci_args))
def test_physical_function(self, *args): with mock.patch.object( builtins, 'open', mock.mock_open(read_data='4')): self.assertTrue(utils.is_physical_function(*self.pci_args))
def test_virtual_function(self, *args): with mock.patch.object( builtins, 'open', side_effect=IOError()): self.assertFalse(utils.is_physical_function(*self.pci_args))
def test_exception(self, mock_listdir): mock_listdir.side_effect = OSError('No such file or directory') self.assertFalse(utils.is_physical_function(self.pci_address))
def test_physical_function(self, mock_listdir): mock_listdir.return_value = ['foo', 'virtfn1', 'bar'] self.assertTrue(utils.is_physical_function(self.pci_address))
def test_physical_function(self, *args): with mock.patch.object(builtins, 'open', mock.mock_open(read_data='4')): self.assertTrue(utils.is_physical_function(*self.pci_args))
def test_virtual_function(self, *args): with mock.patch.object(builtins, 'open', side_effect=IOError()): self.assertFalse(utils.is_physical_function(*self.pci_args))
def _check_physical_function(self): if self.pci_address_spec.is_single_address(): self.is_physical_function = (utils.is_physical_function( self.pci_address_spec.domain, self.pci_address_spec.bus, self.pci_address_spec.slot, self.pci_address_spec.func))