(self)
| 1946 | @support.requires_zlib() |
| 1947 | @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support") |
| 1948 | def test_tarfile_root_owner(self): |
| 1949 | root_dir, base_dir = self._create_files() |
| 1950 | base_name = os.path.join(self.mkdtemp(), 'archive') |
| 1951 | group = grp.getgrgid(0)[0] |
| 1952 | owner = pwd.getpwuid(0)[0] |
| 1953 | with os_helper.change_cwd(root_dir), no_chdir: |
| 1954 | archive_name = make_archive(base_name, 'gztar', root_dir, 'dist', |
| 1955 | owner=owner, group=group) |
| 1956 | |
| 1957 | # check if the compressed tarball was created |
| 1958 | self.assertTrue(os.path.isfile(archive_name)) |
| 1959 | |
| 1960 | # now checks the rights |
| 1961 | archive = tarfile.open(archive_name) |
| 1962 | try: |
| 1963 | for member in archive.getmembers(): |
| 1964 | self.assertEqual(member.uid, 0) |
| 1965 | self.assertEqual(member.gid, 0) |
| 1966 | finally: |
| 1967 | archive.close() |
| 1968 | |
| 1969 | def test_make_archive_cwd_default(self): |
| 1970 | current_dir = os.getcwd() |
nothing calls this directly
no test coverage detected