(filename_1, dirname_1, filename_2)
| 3196 | |
| 3197 | @staticmethod |
| 3198 | def _make_test_archive(filename_1, dirname_1, filename_2): |
| 3199 | # the file contents to write |
| 3200 | fobj = io.BytesIO(b"content") |
| 3201 | |
| 3202 | # create a tar file with a file, a directory, and a file within that |
| 3203 | # directory. Assign various .uid/.gid values to them |
| 3204 | items = [(filename_1, 99, 98, tarfile.REGTYPE, fobj), |
| 3205 | (dirname_1, 77, 76, tarfile.DIRTYPE, None), |
| 3206 | (filename_2, 88, 87, tarfile.REGTYPE, fobj), |
| 3207 | ] |
| 3208 | with tarfile.open(tmpname, 'w') as tarfl: |
| 3209 | for name, uid, gid, typ, contents in items: |
| 3210 | t = tarfile.TarInfo(name) |
| 3211 | t.uid = uid |
| 3212 | t.gid = gid |
| 3213 | t.uname = 'root' |
| 3214 | t.gname = 'root' |
| 3215 | t.type = typ |
| 3216 | tarfl.addfile(t, contents) |
| 3217 | |
| 3218 | # return the full pathname to the tar file |
| 3219 | return tmpname |
| 3220 | |
| 3221 | @staticmethod |
| 3222 | @contextmanager |
no test coverage detected