(self)
| 3506 | unlink(TESTFN2) |
| 3507 | |
| 3508 | def test_extract_command(self): |
| 3509 | zip_name = findfile('zipdir.zip', subdir='archivetestdata') |
| 3510 | for opt in '-e', '--extract': |
| 3511 | with temp_dir() as extdir: |
| 3512 | out = self.zipfilecmd(opt, zip_name, extdir) |
| 3513 | self.assertEqual(out, b'') |
| 3514 | with zipfile.ZipFile(zip_name) as zf: |
| 3515 | for zi in zf.infolist(): |
| 3516 | path = os.path.join(extdir, |
| 3517 | zi.filename.replace('/', os.sep)) |
| 3518 | if zi.is_dir(): |
| 3519 | self.assertTrue(os.path.isdir(path)) |
| 3520 | else: |
| 3521 | self.assertTrue(os.path.isfile(path)) |
| 3522 | with open(path, 'rb') as f: |
| 3523 | self.assertEqual(f.read(), zf.read(zi)) |
| 3524 | |
| 3525 | |
| 3526 | class TestExecutablePrependedZip(unittest.TestCase): |
nothing calls this directly
no test coverage detected