From: Philipp Gesang Date: Thu, 30 Jan 2020 09:41:31 +0000 (+0100) Subject: guard invocations of tar from interactive mode X-Git-Tag: v2.2~7^2~3 X-Git-Url: http://developer.intra2net.com/git/?p=python-delta-tar;a=commitdiff_plain;h=5cf23eabd8eee9e4f0cb6fb535c99b4634c422fe guard invocations of tar from interactive mode On failure, tests may cause GNU tar to prompt for user input like for example volume names etc. which may interrupt the test run. Prevent that by passing /dev/null wherever we shell out to tar. --- diff --git a/deltatar/tarfile.py b/deltatar/tarfile.py index edfe584..b4b784a 100644 --- a/deltatar/tarfile.py +++ b/deltatar/tarfile.py @@ -2787,6 +2787,7 @@ class TarFile(object): self._extfileobj = True self._dbg(3, 'open_volume: using external fileobj {}', fileobj) self.name = os.path.abspath(name) if name else None + self.fileobj.close() self.fileobj = fileobj # init data structures diff --git a/testing/__init__.py b/testing/__init__.py index 8f3bbbe..ebaf6c8 100644 --- a/testing/__init__.py +++ b/testing/__init__.py @@ -29,7 +29,6 @@ def new_volume_handler(tarobj, base_name, volume_number, encryption=None): Handles the new volumes ''' volume_path = "%s.%d" % (base_name, volume_number) - tarobj.close() tarobj.open_volume(volume_path, encryption=encryption) def make_new_encryption_volume_handler(encryption): diff --git a/testing/test_encryption.py b/testing/test_encryption.py index 26e62e0..fee7b41 100644 --- a/testing/test_encryption.py +++ b/testing/test_encryption.py @@ -81,7 +81,7 @@ class EncryptionTest(BaseTest): # extract with normal tar and check output os.system("zcat sample.tar.gz 2>/dev/null > sample.tar") - os.system("tar xf sample.tar") + os.system("tar xf sample.tar /dev/null > sample.tar") - os.system("tar xf sample.tar") + os.system("tar xf sample.tar /dev/null > sample.tar") - os.system("tar xf sample.tar") + os.system("tar xf sample.tar /dev/null > sample.tar" % fname) - os.system("tar xf sample.tar") + os.system("tar xf sample.tar /dev/null > sample.tar" % fname) - os.system("tar xf sample.tar") + os.system("tar xf sample.tar