(mock_geteuid)
| 3221 | @staticmethod |
| 3222 | @contextmanager |
| 3223 | def _setup_test(mock_geteuid): |
| 3224 | mock_geteuid.return_value = 0 # lie and say we're root |
| 3225 | fname = 'numeric-owner-testfile' |
| 3226 | dirname = 'dir' |
| 3227 | |
| 3228 | # the names we want stored in the tarfile |
| 3229 | filename_1 = fname |
| 3230 | dirname_1 = dirname |
| 3231 | filename_2 = os.path.join(dirname, fname) |
| 3232 | |
| 3233 | # create the tarfile with the contents we're after |
| 3234 | tar_filename = NumericOwnerTest._make_test_archive(filename_1, |
| 3235 | dirname_1, |
| 3236 | filename_2) |
| 3237 | |
| 3238 | # open the tarfile for reading. yield it and the names of the items |
| 3239 | # we stored into the file |
| 3240 | with tarfile.open(tar_filename) as tarfl: |
| 3241 | yield tarfl, filename_1, dirname_1, filename_2 |
| 3242 | |
| 3243 | @unittest.mock.patch('os.chown') |
| 3244 | @unittest.mock.patch('os.chmod') |
no test coverage detected