8000 gh-103363: Add follow_symlinks argument to `pathlib.Path.owner()` and `group()` by kamilturek · Pull Request #107962 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-103363: Add follow_symlinks argument to pathlib.Path.owner() and group() #107962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 4, 2023
Prev Previous commit
Next Next commit
Add missing follow_symlinks in tests
  • Loading branch information
kamilturek committed Aug 15, 2023
commit 7296076ae5e0ddfcf4a71cc25d14dbcb26866563
6 changes: 4 additions & 2 deletions Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2608,11 +2608,12 @@ def test_owner_no_follow_symlinks(self):

uid_1, uid_2 = all_users[:2]
os.chown(target, uid_1, -1)
os.chown(link, uid_2, -1)
os.chown(link, uid_2, -1, follow_symlinks=False)

expected_uid = link.stat(follow_symlinks=False).st_uid
expected_name = self._get_pw_name_or_skip_test(expected_uid)

self.assertEqual(expected_uid, uid_2)
self.assertEqual(expected_name, link.owner(follow_symlinks=False))

def _get_gr_name_or_skip_test(self, gid):
Expand All @@ -2639,11 +2640,12 @@ def test_group_no_follow_symlinks(self):

gid_1, gid_2 = all_groups[:2]
os.chown(target, -1, gid_1)
os.chown(link, -1, gid_2)
os.chown(link, -1, gid_2, follow_symlinks=False)

expected_gid = link.stat(follow_symlinks=False).st_gid
expected_name = self._get_pw_name_or_skip_test(expected_gid)

self.assertEqual(expected_gid, gid_2)
self.assertEqual(expected_name, link.group(follow_symlinks=False))

def test_unlink(self):
Expand Down
0