def test_part_devt(self): for part in for_each_partition(self.prog): path = os.path.join(b"/sys/class/block", part_name(part), b"dev") with open(path, "r") as f: expected = f.read().strip() devt = part_devt(part).value_() self.assertEqual(f"{MAJOR(devt)}:{MINOR(devt)}", expected)
def test_loop_part(self): if not self.loop: self.skipTest("could not create loop device") rdev = os.stat(self.loop.fileno()).st_rdev devt = MKDEV(os.major(rdev), os.minor(rdev)) for part in for_each_partition(self.prog): if part_devt(part) == devt: break else: self.fail("loop partition not found") self.assertEqual(part_name(part), os.path.basename(self.loop.name).encode())