In #123354, I found the need to copy code from zipfile into the test:
| deffor_name(cls, name, archive): |
| """ |
| Construct the same way that ZipFile.writestr does. |
| |
| TODO: extract this functionality and re-use |
| """ |
| self=cls(filename=name, date_time=time.localtime(time.time())[:6]) |
| self.compress_type=archive.compression |
| self.compress_level=archive.compresslevel |
| ifself.filename.endswith('/'): # pragma: no cover |
| self.external_attr=0o40775<<16# drwxrwxr-x |
| self.external_attr|=0x10# MS-DOS directory flag |
| else: |
| self.external_attr=0o600<<16# ?rw------- |
| returnself |
Let's instead extract that functionality in the zipfile module for re-use in the test (before it starts diverging).
Linked PRs
In #123354, I found the need to copy code from zipfile into the test:
cpython/Lib/test/test_zipfile/_path/test_path.py
Lines 662 to 676 in 9e108b8
Let's instead extract that functionality in the zipfile module for re-use in the test (before it starts diverging).
Linked PRs
ZipInfo._for_archiveto set suitable default properties #123429