Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[3.13] GH-85633: Fix pathlib test failures on filesystems without world-write. (GH-122883) #122979

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 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions 20 Lib/test/test_pathlib/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1296,18 +1296,20 @@ def test_absolute_posix(self):
)
@needs_posix
def test_open_mode(self):
old_mask = os.umask(0)
# Unmask all permissions except world-write, which may
# not be supported on some filesystems (see GH-85633.)
old_mask = os.umask(0o002)
self.addCleanup(os.umask, old_mask)
p = self.cls(self.base)
with (p / 'new_file').open('wb'):
pass
st = os.stat(self.parser.join(self.base, 'new_file'))
self.assertEqual(stat.S_IMODE(st.st_mode), 0o666)
os.umask(0o022)
self.assertEqual(stat.S_IMODE(st.st_mode), 0o664)
os.umask(0o026)
with (p / 'other_new_file').open('wb'):
pass
st = os.stat(self.parser.join(self.base, 'other_new_file'))
self.assertEqual(stat.S_IMODE(st.st_mode), 0o644)
self.assertEqual(stat.S_IMODE(st.st_mode), 0o640)

@needs_posix
def test_resolve_root(self):
Expand All @@ -1325,16 +1327,18 @@ def test_resolve_root(self):
)
@needs_posix
def test_touch_mode(self):
old_mask = os.umask(0)
# Unmask all permissions except world-write, which may
# not be supported on some filesystems (see GH-85633.)
old_mask = os.umask(0o002)
self.addCleanup(os.umask, old_mask)
p = self.cls(self.base)
(p / 'new_file').touch()
st = os.stat(self.parser.join(self.base, 'new_file'))
self.assertEqual(stat.S_IMODE(st.st_mode), 0o666)
os.umask(0o022)
self.assertEqual(stat.S_IMODE(st.st_mode), 0o664)
os.umask(0o026)
(p / 'other_new_file').touch()
st = os.stat(self.parser.join(self.base, 'other_new_file'))
self.assertEqual(stat.S_IMODE(st.st_mode), 0o644)
self.assertEqual(stat.S_IMODE(st.st_mode), 0o640)
(p / 'masked_new_file').touch(mode=0o750)
st = os.stat(self.parser.join(self.base, 'masked_new_file'))
self.assertEqual(stat.S_IMODE(st.st_mode), 0o750)
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.