Refs #30160 -- Made destination path a required argument of extract().

This commit is contained in:
Nick Pope 2019-02-15 23:33:21 +00:00 committed by Mariusz Felisiak
parent c7bef16a74
commit 0509148c24
2 changed files with 2 additions and 13 deletions

View File

@ -40,7 +40,7 @@ class UnrecognizedArchiveFormat(ArchiveException):
"""
def extract(path, to_path=''):
def extract(path, to_path):
"""
Unpack the tar or zip file at the specified path to the directory
specified by to_path.
@ -83,7 +83,7 @@ class Archive:
def __exit__(self, exc_type, exc_value, traceback):
self.close()
def extract(self, to_path=''):
def extract(self, to_path):
self._archive.extract(to_path)
def list(self):

View File

@ -33,12 +33,6 @@ class ArchiveTester:
archive.extract(self.tmpdir)
self.check_files(self.tmpdir)
def test_extract_method_no_to_path(self):
os.chdir(self.tmpdir)
with Archive(self.archive_path) as archive:
archive.extract()
self.check_files(self.tmpdir)
def test_extract_function(self):
extract(self.archive_path, self.tmpdir)
self.check_files(self.tmpdir)
@ -59,11 +53,6 @@ class ArchiveTester:
extract(self.archive_lead_path, self.tmpdir)
self.check_files(self.tmpdir)
def test_extract_function_no_to_path(self):
os.chdir(self.tmpdir)
extract(self.archive_path)
self.check_files(self.tmpdir)
def check_files(self, tmpdir):
self.assertTrue(os.path.isfile(os.path.join(self.tmpdir, '1')))
self.assertTrue(os.path.isfile(os.path.join(self.tmpdir, '2')))