From 5a654b7d04d28fcb4d4ac8aed83145c6af70feaa Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sun, 6 Dec 2015 20:23:27 +0100 Subject: [PATCH] Make tests non-interactive --- tests/archives/__init__.py | 10 +++++----- tests/test_create.py | 2 +- tests/test_diff.py | 2 +- tests/test_extract.py | 2 +- tests/test_formats.py | 2 +- tests/test_list.py | 2 +- tests/test_recompress.py | 2 +- tests/test_repack.py | 4 ++-- tests/test_search.py | 2 +- tests/test_test.py | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/archives/__init__.py b/tests/archives/__init__.py index 60043bf..5e03f6e 100644 --- a/tests/archives/__init__.py +++ b/tests/archives/__init__.py @@ -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]) diff --git a/tests/test_create.py b/tests/test_create.py index 433d9d4..38139ca 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -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: diff --git a/tests/test_diff.py b/tests/test_diff.py index a13f12a..f18edd7 100644 --- a/tests/test_diff.py +++ b/tests/test_diff.py @@ -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]) diff --git a/tests/test_extract.py b/tests/test_extract.py index c570162..c2f7591 100644 --- a/tests/test_extract.py +++ b/tests/test_extract.py @@ -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) diff --git a/tests/test_formats.py b/tests/test_formats.py index da37ac4..310c974 100644 --- a/tests/test_formats.py +++ b/tests/test_formats.py @@ -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']) diff --git a/tests/test_list.py b/tests/test_list.py index edcbca9..8fd0a1c 100644 --- a/tests/test_list.py +++ b/tests/test_list.py @@ -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]) diff --git a/tests/test_recompress.py b/tests/test_recompress.py index 9b7ebe4..bb3660f 100644 --- a/tests/test_recompress.py +++ b/tests/test_recompress.py @@ -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) diff --git a/tests/test_repack.py b/tests/test_repack.py index 9c2eaf6..916847f 100644 --- a/tests/test_repack.py +++ b/tests/test_repack.py @@ -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) diff --git a/tests/test_search.py b/tests/test_search.py index 00e5667..6ea5a66 100644 --- a/tests/test_search.py +++ b/tests/test_search.py @@ -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]) diff --git a/tests/test_test.py b/tests/test_test.py index 98ba01f..f35331c 100644 --- a/tests/test_test.py +++ b/tests/test_test.py @@ -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])