diff options
author | SKO <41810398+uyw4687@users.noreply.github.com> | 2023-02-25 02:26:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-25 02:26:40 (GMT) |
commit | 56e93c8020e89e1712aa238574bca2076a225028 (patch) | |
tree | f364698ae91c44f4f7dd21a5d88e4962e601fedf /Lib | |
parent | 54dfa14c5a94b893b67a4d9e9e403ff538ce9023 (diff) | |
download | cpython-56e93c8020e89e1712aa238574bca2076a225028.zip cpython-56e93c8020e89e1712aa238574bca2076a225028.tar.gz cpython-56e93c8020e89e1712aa238574bca2076a225028.tar.bz2 |
gh-95675: fix uid and gid at test_add_dir_getmember (gh-102207)
Co-authored-by: Seonkyo Ok <seonkyo.ok@linecorp.com>
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_tarfile.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index f15a800..75b60e9 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -225,18 +225,19 @@ class UstarReadTest(ReadTest, unittest.TestCase): self.add_dir_and_getmember('bar') self.add_dir_and_getmember('a'*101) - @unittest.skipIf( - (hasattr(os, 'getuid') and os.getuid() > 0o777_7777) or - (hasattr(os, 'getgid') and os.getgid() > 0o777_7777), - "uid or gid too high for USTAR format." - ) + @unittest.skipUnless(hasattr(os, "getuid") and hasattr(os, "getgid"), + "Missing getuid or getgid implementation") def add_dir_and_getmember(self, name): + def filter(tarinfo): + tarinfo.uid = tarinfo.gid = 100 + return tarinfo + with os_helper.temp_cwd(): with tarfile.open(tmpname, 'w') as tar: tar.format = tarfile.USTAR_FORMAT try: os.mkdir(name) - tar.add(name) + tar.add(name, filter=filter) finally: os.rmdir(name) with tarfile.open(tmpname) as tar: |