summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-01-18 13:53:39 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-01-18 13:53:39 (GMT)
commit7d68a1c921bb53c5b72fc7a884fc048185001f2c (patch)
tree0036c9f2bc8faec21d54f68873012704452c705f /Lib/test/test_tarfile.py
parentce644a09ac731830aa3a82e9a36e41bc022383c2 (diff)
parent9fbec7ad5e8fcdd9dcc5abd496341b86d12a4472 (diff)
downloadcpython-7d68a1c921bb53c5b72fc7a884fc048185001f2c.zip
cpython-7d68a1c921bb53c5b72fc7a884fc048185001f2c.tar.gz
cpython-7d68a1c921bb53c5b72fc7a884fc048185001f2c.tar.bz2
Issue #20238: TarFile opened with external fileobj and "w:gz" mode didn't
write complete output on close.
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r--Lib/test/test_tarfile.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 72ae31a..e0c9103 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -857,6 +857,12 @@ class WriteTestBase(TarTest):
tar.addfile(tarfile.TarInfo("foo"))
tar.close()
self.assertFalse(fobj.closed, "external fileobjs must never closed")
+ # Issue #20238: Incomplete gzip output with mode="w:gz"
+ data = fobj.getvalue()
+ del tar
+ support.gc_collect()
+ self.assertFalse(fobj.closed)
+ self.assertEqual(data, fobj.getvalue())
class WriteTest(WriteTestBase, unittest.TestCase):