Exemplo n.º 1
0
 def test_extract(self):
     tmpdir = util.tmpdir(dir=basedir)
     try:
         archive = os.path.join(datadir, "t .7z")
         util.run_checked([sys.executable, patool_cmd, "-vv", "extract", "--outdir", tmpdir, archive])
     finally:
         shutil.rmtree(tmpdir)
Exemplo n.º 2
0
 def test_extract(self):
     tmpdir = util.tmpdir(dir=basedir)
     try:
         archive = os.path.join(datadir, "t .7z")
         util.run_checked([sys.executable, patool_cmd, "-vv", "extract", "--outdir", tmpdir, archive])
     finally:
         shutil.rmtree(tmpdir)
Exemplo n.º 3
0
 def test_diff(self):
     archive1 = os.path.join(datadir, "t.tar")
     archive2 = os.path.join(datadir, "t.zip")
     run_checked([
         sys.executable, patool_cmd, "-vv", "--non-interactive", "diff",
         archive1, archive2
     ])
Exemplo n.º 4
0
def run_archive_cmdlist (archive_cmdlist):
    """Run archive command."""
    # archive_cmdlist is a command list with optional keyword arguments
    if isinstance(archive_cmdlist, tuple):
        cmdlist, runkwargs = archive_cmdlist
    else:
        cmdlist, runkwargs = archive_cmdlist, {}
    util.run_checked(cmdlist, **runkwargs)
Exemplo n.º 5
0
 def repack(self, name1, name2):
     """Repack archive with name1 to archive with name2."""
     archive1 = os.path.join(datadir, name1)
     tmpdir = util.tmpdir()
     try:
         archive2 = os.path.join(tmpdir, name2)
         util.run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "repack", archive1, archive2])
         util.run_checked([sys.executable, patool_cmd, "--non-interactive", "diff", archive1, archive2])
     finally:
         shutil.rmtree(tmpdir)
Exemplo n.º 6
0
 def repack(self, name1, name2):
     """Repack archive with name1 to archive with name2."""
     archive1 = os.path.join(datadir, name1)
     tmpdir = util.tmpdir()
     try:
         archive2 = os.path.join(tmpdir, name2)
         util.run_checked([sys.executable, patool_cmd, "-vv", "repack", archive1, archive2])
         util.run_checked([sys.executable, patool_cmd, "diff", archive1, archive2])
     finally:
         shutil.rmtree(tmpdir)
Exemplo n.º 7
0
 def test_create(self):
     tmpdir = util.tmpdir(dir=basedir)
     try:
         files = [os.path.join(datadir, "t"), os.path.join(datadir, "t.txt")]
         archive = os.path.join(tmpdir, "t.7z")
         cmd = [sys.executable, patool_cmd, "-vv", "create", archive]
         cmd.extend(files)
         util.run_checked(cmd)
     finally:
         shutil.rmtree(tmpdir)
Exemplo n.º 8
0
 def recompress(self, name):
     """Recompress archive with given name."""
     archive = os.path.join(datadir, name)
     ext = os.path.splitext(archive)[1]
     tmpfile = util.tmpfile(suffix=ext)
     try:
         shutil.copy(archive, tmpfile)
         util.run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "recompress", tmpfile])
     finally:
         if os.path.exists(tmpfile):
             os.remove(tmpfile)
Exemplo n.º 9
0
 def recompress(self, name):
     """Recompress archive with given name."""
     archive = os.path.join(datadir, name)
     ext = os.path.splitext(archive)[1]
     tmpfile = util.tmpfile(suffix=ext)
     try:
         shutil.copy(archive, tmpfile)
         util.run_checked(
             [sys.executable, patool_cmd, "-vv", "recompress", tmpfile])
     finally:
         if os.path.exists(tmpfile):
             os.remove(tmpfile)
Exemplo n.º 10
0
 def test_list_formats(self):
     run_checked([sys.executable, patool_cmd, "-vv", 'formats'])
Exemplo n.º 11
0
 def test_test(self):
     archive = os.path.join(datadir, "t .7z")
     run_checked([sys.executable, patool_cmd, "test", archive])
Exemplo n.º 12
0
 def test_list(self):
     archive = os.path.join(datadir, "t.tar")
     run_checked([sys.executable, patool_cmd, "-vv", "list", archive])
Exemplo n.º 13
0
 def test_diff (self):
     archive1 = os.path.join(datadir, "t.tar")
     archive2 = os.path.join(datadir, "t.zip")
     run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "diff", archive1, archive2])
Exemplo n.º 14
0
 def test_list_formats (self):
     run_checked([sys.executable, patool_cmd, "-vv", 'formats'])
Exemplo n.º 15
0
 def test_test(self):
     archive = os.path.join(datadir, "t .7z")
     run_checked([sys.executable, patool_cmd, "test", archive])
Exemplo n.º 16
0
 def search(self, pattern, archive):
     run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "search", pattern, archive])
Exemplo n.º 17
0
 def search(self, pattern, archive):
     run_checked(
         [sys.executable, patool_cmd, "-vv", "search", pattern, archive])
Exemplo n.º 18
0
 def test_list_formats (self):
     run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", 'formats'])