Skip to content

Commit

Permalink
Make tests non-interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
wummel committed Dec 6, 2015
1 parent a546db1 commit 5a654b7
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions tests/archives/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _archive_extract (self, archive, check, verbosity=0):
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:
Expand Down Expand Up @@ -117,13 +117,13 @@ def archive_list (self, filename):
"""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."""
Expand Down Expand Up @@ -156,7 +156,7 @@ def _archive_create (self, archive, srcfiles, program=None, verbosity=0):
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)
Expand Down Expand Up @@ -208,7 +208,7 @@ def check_created_archive_with_diff(self, archive, srcfiles):
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])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_create(self):
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:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
2 changes: 1 addition & 1 deletion tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ 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])
util.run_checked([sys.executable, patool_cmd, "-vv", "--non-interactive", "extract", "--outdir", tmpdir, archive])
finally:
shutil.rmtree(tmpdir)
2 changes: 1 addition & 1 deletion tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
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'])
2 changes: 1 addition & 1 deletion tests/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
2 changes: 1 addition & 1 deletion tests/test_recompress.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def recompress(self, name):
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)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_repack.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def repack(self, name1, name2):
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)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ def test_search(self):
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])
2 changes: 1 addition & 1 deletion tests/test_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

0 comments on commit 5a654b7

Please sign in to comment.