test_archive_5.py 637 B

1234567891011121314151617181920
  1. def test_zip_extract_ro_dir(self):
  2. src = os.path.join(self.tmp, "src")
  3. os.mkdir(src)
  4. ro1 = os.path.join(src, "ro1")
  5. os.mkdir(ro1)
  6. ro2 = os.path.join(ro1, "ro2")
  7. os.mkdir(ro2)
  8. a = os.path.join(ro2, "a")
  9. with open(a, "w") as fp:
  10. fp.write("a\n")
  11. # RO dir inside an other RO dir
  12. os.chmod(ro2, stat.S_IRUSR | stat.S_IXUSR)
  13. os.chmod(ro1, stat.S_IRUSR | stat.S_IXUSR)
  14. archive = qibuild.archive.zip(src)
  15. dest = os.path.join(self.tmp, "dest")
  16. os.mkdir(dest)
  17. qibuild.archive.extract(archive, dest)
  18. ls_r = qibuild.sh.ls_r(dest)
  19. self.assertEquals(ls_r, ["src/ro1/ro2/a"])