Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 def test_for_each_partition(self):
     self.assertEqual(
         {
             part_name(part).decode()
             for part in for_each_partition(self.prog)
         },
         set(os.listdir("/sys/class/block")),
     )
Exemplo n.º 3
0
 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())