mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Issue #29210: Removed support of deprecated argument "exclude" in
tarfile.TarFile.add().
This commit is contained in:
parent
62db0db5cb
commit
4f76fb16b7
5 changed files with 11 additions and 49 deletions
|
|
@ -1145,33 +1145,6 @@ class WriteTest(WriteTestBase, unittest.TestCase):
|
|||
finally:
|
||||
tar.close()
|
||||
|
||||
def test_exclude(self):
|
||||
tempdir = os.path.join(TEMPDIR, "exclude")
|
||||
os.mkdir(tempdir)
|
||||
try:
|
||||
for name in ("foo", "bar", "baz"):
|
||||
name = os.path.join(tempdir, name)
|
||||
support.create_empty_file(name)
|
||||
|
||||
exclude = os.path.isfile
|
||||
|
||||
tar = tarfile.open(tmpname, self.mode, encoding="iso8859-1")
|
||||
try:
|
||||
with support.check_warnings(("use the filter argument",
|
||||
DeprecationWarning)):
|
||||
tar.add(tempdir, arcname="empty_dir", exclude=exclude)
|
||||
finally:
|
||||
tar.close()
|
||||
|
||||
tar = tarfile.open(tmpname, "r")
|
||||
try:
|
||||
self.assertEqual(len(tar.getmembers()), 1)
|
||||
self.assertEqual(tar.getnames()[0], "empty_dir")
|
||||
finally:
|
||||
tar.close()
|
||||
finally:
|
||||
support.rmtree(tempdir)
|
||||
|
||||
def test_filter(self):
|
||||
tempdir = os.path.join(TEMPDIR, "filter")
|
||||
os.mkdir(tempdir)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue