From e6b82556343116256be047ab7099bedd9063f66a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Thu, 22 Sep 2022 19:43:53 -0400 Subject: New upstream version 1.23.1. --- test/test_postprocessor.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'test/test_postprocessor.py') diff --git a/test/test_postprocessor.py b/test/test_postprocessor.py index 42babd3..af8b0af 100644 --- a/test/test_postprocessor.py +++ b/test/test_postprocessor.py @@ -452,9 +452,11 @@ class ZipTest(BasePostprocessorTest): self.assertTrue(pp.args[0].endswith("/test.cbz")) def test_zip_write(self): - pp = self._create() - with tempfile.NamedTemporaryFile("w", dir=self.dir.name) as file: + pp = self._create({"files": [file.name, "_info_.json"], + "keep-files": True}) + + filename = os.path.basename(file.name) file.write("foobar\n") # write dummy file with 3 different names @@ -466,18 +468,19 @@ class ZipTest(BasePostprocessorTest): self._trigger() nti = pp.zfile.NameToInfo - self.assertEqual(len(nti), i+1) + self.assertEqual(len(nti), i+2) self.assertIn(name, nti) # check file contents - self.assertEqual(len(nti), 3) + self.assertEqual(len(nti), 4) self.assertIn("file0.ext", nti) self.assertIn("file1.ext", nti) self.assertIn("file2.ext", nti) + self.assertIn(filename, nti) # write the last file a second time (will be skipped) self._trigger() - self.assertEqual(len(pp.zfile.NameToInfo), 3) + self.assertEqual(len(pp.zfile.NameToInfo), 4) # close file self._trigger(("finalize",), 0) @@ -485,10 +488,11 @@ class ZipTest(BasePostprocessorTest): # reopen to check persistence with zipfile.ZipFile(pp.zfile.filename) as file: nti = file.NameToInfo - self.assertEqual(len(pp.zfile.NameToInfo), 3) + self.assertEqual(len(pp.zfile.NameToInfo), 4) self.assertIn("file0.ext", nti) self.assertIn("file1.ext", nti) self.assertIn("file2.ext", nti) + self.assertIn(filename, nti) os.unlink(pp.zfile.filename) -- cgit v1.2.3