Lines Matching refs:TESTFN
22 from test.support import (TESTFN, findfile, unlink, rmtree, temp_dir, temp_cwd,
26 TESTFN2 = TESTFN + "2"
27 TESTFNDIR = TESTFN + "d"
55 with open(TESTFN, "wb") as fp:
62 zipfp.write(TESTFN, "another.name")
63 zipfp.write(TESTFN, TESTFN)
74 self.assertEqual(zipfp.read(TESTFN), self.data)
98 self.assertIn(TESTFN, names)
107 self.assertIn(TESTFN, names)
115 for nm in (TESTFN, "another.name", "strfile", "written-open-w"):
133 with zipfp.open(TESTFN) as zipopen1:
167 with zipfp.open(TESTFN) as zipopen1:
185 zipfp.open(TESTFN) as zipopen:
204 zipfp.open(TESTFN) as zipopen:
224 zipfp.open(TESTFN) as zipopen:
249 with zipfp.open(TESTFN) as zipopen:
263 with zipfp.open(TESTFN) as zipopen:
277 with zipfp.open(TESTFN) as zipopen:
365 zipfp.write(TESTFN, fname)
400 zipfp.write(TESTFN, 'compress_1')
401 zipfp.write(TESTFN, 'compress_9', compresslevel=9)
445 unlink(TESTFN)
473 zipfp.write(TESTFN, "/absolute")
481 zipfp.write(TESTFN, TESTFN)
485 self.assertEqual(zipfp.namelist(), [TESTFN, "strfile"])
496 zipfp.write(TESTFN, TESTFN)
501 self.assertEqual(zipfp.namelist(), [TESTFN])
502 self.assertEqual(zipfp.read(TESTFN), self.data)
507 self.assertEqual(zipfp.namelist(), [TESTFN])
508 self.assertEqual(zipfp.read(TESTFN), self.data)
513 zipfp.write(TESTFN, TESTFN)
521 self.assertEqual(zipfp.namelist(), [TESTFN])
522 self.assertEqual(zipfp.read(TESTFN), self.data)
527 zipfp.write(TESTFN, TESTFN)
535 self.assertEqual(zipfp.namelist(), [TESTFN])
542 self.assertEqual(zipfp.namelist(), [TESTFN, 'strfile'])
543 self.assertEqual(zipfp.read(TESTFN), self.data)
548 zipfp.write(TESTFN, TESTFN)
557 zipfp.write(TESTFN, TESTFN)
568 zipfp.write(TESTFN)
569 with open(TESTFN, "rb") as f:
570 self.assertEqual(zipfp.read(TESTFN), f.read())
593 self.assertRaises(ValueError, zipfp.write, TESTFN)
597 zipfp.open(TESTFN, mode='w')
601 os.utime(TESTFN, (0, 0))
603 self.assertRaises(ValueError, zipfp.write, TESTFN)
606 zipfp.write(TESTFN)
607 zinfo = zipfp.getinfo(TESTFN)
618 os.utime(TESTFN, (ts, ts))
622 mtime_ns = os.stat(TESTFN).st_mtime_ns
635 self.assertRaises(struct.error, zipfp.write, TESTFN)
638 zipfp.write(TESTFN)
639 zinfo = zipfp.getinfo(TESTFN)
652 zipfp.write(TESTFN, 'storeme', zipfile.ZIP_STORED)
653 zipfp.write(TESTFN, 'deflateme', zipfile.ZIP_DEFLATED)
687 with open(TESTFN, "wb") as fp:
693 zipfp.write(TESTFN, "another.name")
694 zipfp.write(TESTFN, TESTFN)
699 self.assertEqual(zipfp.read(TESTFN), self.data)
724 self.assertIn(TESTFN, names)
732 self.assertIn(TESTFN, names)
739 for nm in (TESTFN, "another.name", "strfile"):
754 zipf = zipfile.ZipFile(TESTFN, "w", self.compression,
763 zipf2 = zipfile.ZipFile(TESTFN, "r", self.compression)
771 zipf = zipfile.ZipFile(TESTFN, "w", self.compression,
783 zipf = zipfile.ZipFile(TESTFN, "a", self.compression,
792 zipf = zipfile.ZipFile(TESTFN, "a", self.compression,
802 zipf2 = zipfile.ZipFile(TESTFN, "r", self.compression)
812 unlink(TESTFN)
823 zipfp.write, TESTFN, "another.name")
838 zipfp.write(TESTFN, "/absolute")
1288 with open(TESTFN, 'w') as f:
1290 self.assertRaises(RuntimeError, zipfp.writepy, TESTFN)
1291 unlink(TESTFN)
1594 with zipfile.ZipFile(TESTFN, "w") as zf:
1599 with zipfile.ZipFile(TESTFN, "r") as zf:
1622 if os.path.exists(TESTFN):
1623 os.unlink(TESTFN)
1629 with zipfile.ZipFile(TESTFN, 'a') as zf:
1634 self.assertTrue(os.path.exists(TESTFN))
1636 with zipfile.ZipFile(TESTFN, 'r') as zf:
1647 with open(TESTFN, "w") as fp:
1650 zf = zipfile.ZipFile(TESTFN)
1657 with open(TESTFN, "w") as fp:
1659 self.assertFalse(zipfile.is_zipfile(TESTFN))
1661 self.assertFalse(zipfile.is_zipfile(pathlib.Path(TESTFN)))
1663 with open(TESTFN, "rb") as fp:
1689 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1692 self.assertTrue(zipfile.is_zipfile(TESTFN))
1694 with open(TESTFN, "rb") as fp:
1717 self.assertRaises(OSError, zipfile.ZipFile, TESTFN)
1720 f = open(TESTFN, 'w')
1722 self.assertRaises(zipfile.BadZipFile, zipfile.ZipFile, TESTFN)
1724 with open(TESTFN, 'w') as fp:
1726 self.assertRaises(zipfile.BadZipFile, zipfile.ZipFile, TESTFN)
1742 with open(TESTFN, 'w') as f:
1744 self.assertRaises(ValueError, zipf.write, TESTFN)
1748 self.assertRaises(ValueError, zipfile.ZipFile, TESTFN, "q")
1752 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1755 with zipfile.ZipFile(TESTFN, mode="r") as zipf:
1766 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1778 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1784 self.assertRaises(NotImplementedError, zipfile.ZipFile, TESTFN, "w", -1)
1800 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1815 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1819 with zipfile.ZipFile(TESTFN, mode="r") as zipfr:
1824 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1827 with zipfile.ZipFile(TESTFN, mode="r") as zipfr:
1833 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1837 with zipfile.ZipFile(TESTFN, mode="r") as zipfr:
1841 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1845 with zipfile.ZipFile(TESTFN, mode="r") as zipfr:
1849 with zipfile.ZipFile(TESTFN,mode="w") as zipf:
1852 with zipfile.ZipFile(TESTFN,mode="a") as zipf:
1854 with zipfile.ZipFile(TESTFN,mode="r") as zipf:
1859 with zipfile.ZipFile(TESTFN,mode="w") as zipf:
1862 original_zip_size = os.path.getsize(TESTFN)
1863 with zipfile.ZipFile(TESTFN,mode="a") as zipf:
1865 self.assertTrue(original_zip_size > os.path.getsize(TESTFN))
1866 with zipfile.ZipFile(TESTFN,mode="r") as zipf:
1870 with zipfile.ZipFile(TESTFN, "w", zipfile.ZIP_STORED) as zipf:
1876 with zipfile.ZipFile(TESTFN, "a", zipfile.ZIP_STORED) as zipf:
1879 with zipfile.ZipFile(TESTFN, "r") as zipf:
1883 with zipfile.ZipFile(TESTFN, "w", zipfile.ZIP_STORED) as zipf:
1885 with zipfile.ZipFile(TESTFN, "a", zipfile.ZIP_STORED) as zipf:
1888 with zipfile.ZipFile(TESTFN, "r") as zipf:
1894 zipf = zipfile.ZipFile(TESTFN, mode="w")
1897 zipf = zipfile.ZipFile(TESTFN, mode="r")
1901 zipf = zipfile.ZipFile(TESTFN, mode="a")
1904 zipf = zipfile.ZipFile(TESTFN, mode="r")
1912 f = open(TESTFN, 'w')
1914 self.assertRaises(zipfile.BadZipFile, zipfile.ZipFile, TESTFN, 'r')
1996 with zipfile.ZipFile(TESTFN, "w") as zipf:
1998 with zipfile.ZipFile(TESTFN, "r") as zipf:
2040 unlink(TESTFN)
2158 with open(TESTFN, "wb") as fp:
2160 self.zip = zipfile.ZipFile(TESTFN, "r")
2167 os.unlink(TESTFN)
2243 with open(TESTFN, "wb") as fp:
2247 unlink(TESTFN)
2253 zipfp.write(TESTFN, "another.name")
2254 zipfp.write(TESTFN, TESTFN)
2261 testdata = zipfp.read(TESTFN)
2276 with zipfp.open(TESTFN) as zipopen1:
2309 with zipfp.open(TESTFN) as zipopen1:
2396 self.addCleanup(unlink, TESTFN)
2397 with open(TESTFN, 'wb') as f2:
2399 zipfp.write(TESTFN, 'ones')
2400 with open(TESTFN, 'wb') as f2:
2402 zipfp.write(TESTFN, 'twos')
2573 with zipfile.ZipFile(TESTFN, "w") as zipf:
2582 with zipfile.ZipFile(TESTFN, "r") as zipf:
2597 with zipfile.ZipFile(TESTFN, "w") as zipf:
2602 with zipfile.ZipFile(TESTFN, "r") as zipf:
2614 if os.path.exists(TESTFN):
2615 unlink(TESTFN)
2695 self.addCleanup(unlink, TESTFN)
2696 with open(TESTFN, 'w') as f:
2702 files = [TESTFN, TESTFNDIR]
2703 namelist = [TESTFN, TESTFNDIR + '/', TESTFNDIR + '/file.txt']