MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_make_archive_owner_group

Method test_make_archive_owner_group

Lib/test/test_shutil.py:1919–1943  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1917
1918 @support.requires_zlib()
1919 def test_make_archive_owner_group(self):
1920 # testing make_archive with owner and group, with various combinations
1921 # this works even if there's not gid/uid support
1922 if UID_GID_SUPPORT:
1923 group = grp.getgrgid(0)[0]
1924 owner = pwd.getpwuid(0)[0]
1925 else:
1926 group = owner = 'root'
1927
1928 root_dir, base_dir = self._create_files()
1929 base_name = os.path.join(self.mkdtemp(), 'archive')
1930 res = make_archive(base_name, 'zip', root_dir, base_dir, owner=owner,
1931 group=group)
1932 self.assertTrue(os.path.isfile(res))
1933
1934 res = make_archive(base_name, 'zip', root_dir, base_dir)
1935 self.assertTrue(os.path.isfile(res))
1936
1937 res = make_archive(base_name, 'tar', root_dir, base_dir,
1938 owner=owner, group=group)
1939 self.assertTrue(os.path.isfile(res))
1940
1941 res = make_archive(base_name, 'tar', root_dir, base_dir,
1942 owner='kjhkjhkjg', group='oihohoh')
1943 self.assertTrue(os.path.isfile(res))
1944
1945
1946 @support.requires_zlib()

Callers

nothing calls this directly

Calls 6

_create_filesMethod · 0.95
make_archiveFunction · 0.90
mkdtempMethod · 0.80
assertTrueMethod · 0.80
joinMethod · 0.45
isfileMethod · 0.45

Tested by

no test coverage detected