Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitba8c0f5

Browse files
committed
useos.path.realpath in test
1 parent491b40f commitba8c0f5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎Lib/test/test_tarfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,14 +1684,14 @@ def test_missing_fileobj(self):
16841684
@unittest.mock.patch('os.chmod')
16851685
deftest_deferred_directory_attributes_update(self,mock_chmod):
16861686
# Regression test for gh-127987: setting attributes on arbitrary files
1687-
tempdir=os.path.join(TEMPDIR,'test127987')
1687+
tempdir=os.path.realpath(os.path.join(TEMPDIR,'test127987'))
16881688
defmock_chmod_side_effect(path,mode,**kwargs):
16891689
target_path=os.path.realpath(path)
16901690
ifos.path.commonpath([target_path,tempdir])!=tempdir:
1691-
raiseException("should not tryto chmodanythingoutside thedestination",target_path)
1691+
raiseException(f"triedto chmod{path!r} ({target_path!r}) which isoutside thetree ({tempdir!r})")
16921692
mock_chmod.side_effect=mock_chmod_side_effect
16931693

1694-
outside_tree_dir=os.path.join(TEMPDIR,'outside_tree_dir')
1694+
outside_tree_dir=os.path.realpath(os.path.join(TEMPDIR,'outside_tree_dir'))
16951695
withArchiveMaker()asarc:
16961696
arc.add('x',symlink_to='.')
16971697
arc.add('x',type=tarfile.DIRTYPE,mode='?rwsrwsrwt')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp