(self)
| 1417 | self.assertEqual(data, fobj.getvalue()) |
| 1418 | |
| 1419 | def test_eof_marker(self): |
| 1420 | # Make sure an end of archive marker is written (two zero blocks). |
| 1421 | # tarfile insists on aligning archives to a 20 * 512 byte recordsize. |
| 1422 | # So, we create an archive that has exactly 10240 bytes without the |
| 1423 | # marker, and has 20480 bytes once the marker is written. |
| 1424 | with tarfile.open(tmpname, self.mode) as tar: |
| 1425 | t = tarfile.TarInfo("foo") |
| 1426 | t.size = tarfile.RECORDSIZE - tarfile.BLOCKSIZE |
| 1427 | tar.addfile(t, io.BytesIO(b"a" * t.size)) |
| 1428 | |
| 1429 | with self.open(tmpname, "rb") as fobj: |
| 1430 | self.assertEqual(len(fobj.read()), tarfile.RECORDSIZE * 2) |
| 1431 | |
| 1432 | |
| 1433 | class WriteTest(WriteTestBase, unittest.TestCase): |
nothing calls this directly
no test coverage detected