test_archive_3.py 626 B

123456789101112131415161718192021
  1. def test_zip_extract(self):
  2. # Create some files in the temp dir:
  3. src = os.path.join(self.tmp, "src")
  4. os.mkdir(src)
  5. # Create a empty dir called a, and two files named
  6. # b and c
  7. a = os.path.join(src, "a")
  8. os.mkdir(a)
  9. b = os.path.join(a, "b")
  10. with open(b, "w") as fp:
  11. fp.write("b\n")
  12. c = os.path.join(a, "c")
  13. with open(c, "w") as fp:
  14. fp.write("c\n")
  15. archive = qibuild.archive.zip(a)
  16. dest = os.path.join(self.tmp, "dest")
  17. os.mkdir(dest)
  18. qibuild.archive.extract(archive, dest)
  19. ls_r = qibuild.sh.ls_r(dest)
  20. self.assertEquals(ls_r, ["a/b", "a/c"])