Ejemplo n.º 1
11
    def runTest(self):
        # Make sure there are some devices in the system first and then
        # make a list out of them.  That's easier to work with.
        _ped.device_probe_all()
        lst = self.getDeviceList(_ped.device_get_next)

        # Now the test cases.
        self.assertGreater(len(lst), 0)
        self.assertRaises(TypeError, _ped.device_get_next, None)

        for ele in lst:
            self.assertIsInstance(ele, _ped.Device)

        self.assertRaises(IndexError, _ped.device_get_next, lst[-1])
Ejemplo n.º 2
0
    def runTest(self):
        # Since we inherit from RequiresDevice, we can test that the temp
        # device we created is in the results list.  I can't really think of
        # any other way to test this method except by getting a list of devices
        # via some other mechanism and comparing that to the device_probe_all
        # results.
        _ped.device_probe_all()
        lst = self.getDeviceList(_ped.device_get_next)

        self.assertGreater(len(lst), 0)
        self.assertGreater(len(filter(lambda e: e.path.startswith("/tmp/temp-device-"), lst)), 0)
Ejemplo n.º 3
0
    def runTest(self):
        # Since we inherit from RequiresDevice, we can test that the temp
        # device we created is in the results list.  I can't really think of
        # any other way to test this method except by getting a list of devices
        # via some other mechanism and comparing that to the device_probe_all
        # results.
        _ped.device_probe_all()
        lst = self.getDeviceList(_ped.device_get_next)

        self.assertGreater(len(lst), 0)
        self.assertGreater(
            len([e for e in lst if e.path.startswith("/tmp/temp-device-")]), 0)
Ejemplo n.º 4
0
    def runTest(self):
        # Since we inherit from RequiresDevice, we can test that the temp
        # device we created is in the results list.  I can't really think of
        # any other way to test this method except by getting a list of devices
        # via some other mechanism and comparing that to the device_probe_all
        # results.
        _ped.device_probe_all()
        lst = self.getDeviceList(_ped.device_get_next)
        prefix = self.path[:self.path.index(self.temp_prefix) - 1] + "/" + self.temp_prefix

        self.assertGreater(len(lst), 0)
        self.assertGreater(
            len([e for e in lst if e.path.startswith(prefix)]), 0)
Ejemplo n.º 5
0
    def runTest(self):
        # Make sure there are some devices in the system first and then
        # make a list out of them.  That's easier to work with.
        _ped.device_probe_all()
        lst = self.getDeviceList(_ped.device_get_next)

        # Now the test cases.
        self.assertGreater(len(lst), 0)
        self.assertRaises(TypeError, _ped.device_get_next, None)

        for ele in lst:
            self.assertIsInstance(ele, _ped.Device)

        self.assertRaises(IndexError, _ped.device_get_next, lst[-1])
Ejemplo n.º 6
0
def getAllDevices():
    """Return a list of Device objects for all devices in the system."""
    from _ped import device_probe_all
    from _ped import device_get_next

    lst = []
    device = None

    device_probe_all()

    while True:
        try:
            if not device:
                device = device_get_next()
            else:
                device = device_get_next(device)

            lst.append(Device(PedDevice=device))
        except IndexError:
            return lst
Ejemplo n.º 7
0
def getAllDevices():
    """Return a list of Device objects for all devices in the system."""
    from _ped import device_probe_all
    from _ped import device_get_next

    lst = []
    device = None

    device_probe_all()

    while True:
        try:
            if not device:
                device = device_get_next()
            else:
                device = device_get_next(device)

            lst.append(Device(PedDevice=device))
        except IndexError:
            return lst
Ejemplo n.º 8
0
 def runTest(self):
     _ped.device_probe_all()
     self.assertEqual(_ped.device_free_all(), None)
Ejemplo n.º 9
0
 def runTest(self):
     _ped.device_probe_all()
     self.assertEqual(_ped.device_free_all(), None)