Make tests non-interactive
This commit is contained in:
parent
a546db107a
commit
5a654b7d04
|
@ -75,7 +75,7 @@ class ArchiveTest (unittest.TestCase):
|
|||
try:
|
||||
olddir = patoolib.util.chdir(tmpdir)
|
||||
try:
|
||||
output = patoolib.extract_archive(archive, program=self.program, verbosity=verbosity)
|
||||
output = patoolib.extract_archive(archive, program=self.program, verbosity=verbosity, interactive=False)
|
||||
if check:
|
||||
self.check_extracted_archive(archive, output, check)
|
||||
finally:
|
||||
|
@ -117,13 +117,13 @@ class ArchiveTest (unittest.TestCase):
|
|||
"""Test archive listing."""
|
||||
archive = os.path.join(datadir, filename)
|
||||
for verbosity in (-1, 0, 1, 2):
|
||||
patoolib.list_archive(archive, program=self.program, verbosity=verbosity)
|
||||
patoolib.list_archive(archive, program=self.program, verbosity=verbosity, interactive=False)
|
||||
|
||||
def archive_test (self, filename):
|
||||
"""Test archive testing."""
|
||||
archive = os.path.join(datadir, filename)
|
||||
for verbosity in (-1, 0, 1, 2):
|
||||
patoolib.test_archive(archive, program=self.program, verbosity=verbosity)
|
||||
patoolib.test_archive(archive, program=self.program, verbosity=verbosity, interactive=False)
|
||||
|
||||
def archive_create (self, archive, srcfiles=None, check=Content.Recursive):
|
||||
"""Test archive creation."""
|
||||
|
@ -156,7 +156,7 @@ class ArchiveTest (unittest.TestCase):
|
|||
try:
|
||||
archive = os.path.join(tmpdir, archive)
|
||||
self.assertTrue(os.path.isabs(archive), "archive path is not absolute: %r" % archive)
|
||||
patoolib.create_archive(archive, srcfiles, verbosity=verbosity, program=program)
|
||||
patoolib.create_archive(archive, srcfiles, verbosity=verbosity, interactive=False, program=program)
|
||||
self.assertTrue(os.path.isfile(archive))
|
||||
self.check_created_archive_with_test(archive)
|
||||
self.check_created_archive_with_diff(archive, srcfiles)
|
||||
|
@ -208,7 +208,7 @@ class ArchiveTest (unittest.TestCase):
|
|||
try:
|
||||
olddir = patoolib.util.chdir(tmpdir)
|
||||
try:
|
||||
output = patoolib.extract_archive(archive, program=program)
|
||||
output = patoolib.extract_archive(archive, program=program, interactive=False)
|
||||
if len(srcfiles) == 1:
|
||||
source = os.path.join(datadir, srcfiles[0])
|
||||
patoolib.util.run_checked([diff, "-urN", source, output])
|
||||
|
|
|
@ -28,7 +28,7 @@ class ArchiveCreateTest (unittest.TestCase):
|
|||
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 = [sys.executable, patool_cmd, "-vv", "--non-interactive", "create", archive]
|
||||
cmd.extend(files)
|
||||
util.run_checked(cmd)
|
||||
finally:
|
||||
|
|
|
@ -27,4 +27,4 @@ class ArchiveDiffTest (unittest.TestCase):
|
|||
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", "diff", archive1, archive2])
|
||||
run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "diff", archive1, archive2])
|
||||
|
|
|
@ -27,6 +27,6 @@ class ArchiveExtractTest (unittest.TestCase):
|
|||
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])
|
||||
util.run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "extract", "--outdir", tmpdir, archive])
|
||||
finally:
|
||||
shutil.rmtree(tmpdir)
|
||||
|
|
|
@ -21,4 +21,4 @@ from . import patool_cmd
|
|||
class TestFormats (unittest.TestCase):
|
||||
|
||||
def test_list_formats (self):
|
||||
run_checked([sys.executable, patool_cmd, "-vv", 'formats'])
|
||||
run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", 'formats'])
|
||||
|
|
|
@ -24,4 +24,4 @@ class ArchiveListTest (unittest.TestCase):
|
|||
@needs_program('tar')
|
||||
def test_list(self):
|
||||
archive = os.path.join(datadir, "t.tar")
|
||||
run_checked([sys.executable, patool_cmd, "-vv", "list", archive])
|
||||
run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "list", archive])
|
||||
|
|
|
@ -29,7 +29,7 @@ class ArchiveRecompressTest (unittest.TestCase):
|
|||
tmpfile = util.tmpfile(suffix=ext)
|
||||
try:
|
||||
shutil.copy(archive, tmpfile)
|
||||
util.run_checked([sys.executable, patool_cmd, "-vv", "recompress", tmpfile])
|
||||
util.run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "recompress", tmpfile])
|
||||
finally:
|
||||
if os.path.exists(tmpfile):
|
||||
os.remove(tmpfile)
|
||||
|
|
|
@ -28,8 +28,8 @@ class ArchiveRepackTest (unittest.TestCase):
|
|||
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])
|
||||
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)
|
||||
|
||||
|
|
|
@ -32,4 +32,4 @@ class ArchiveSearchTest (unittest.TestCase):
|
|||
self.search(pattern, archive)
|
||||
|
||||
def search(self, pattern, archive):
|
||||
run_checked([sys.executable, patool_cmd, "-vv", "search", pattern, archive])
|
||||
run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "search", pattern, archive])
|
||||
|
|
|
@ -24,4 +24,4 @@ class ArchiveTestTest (unittest.TestCase):
|
|||
@needs_program('7z')
|
||||
def test_test(self):
|
||||
archive = os.path.join(datadir, "t .7z")
|
||||
run_checked([sys.executable, patool_cmd, "test", archive])
|
||||
run_checked([sys.executable, patool_cmd, "--non-interactive", "test", archive])
|
||||
|
|
Loading…
Reference in New Issue