@@ -774,51 +774,6 @@ def test_realpath_cwd(self):
774774 test_file_long ,
775775 ntpath .realpath ("file.txt" , ** kwargs ))
776776
777- @unittest .skipUnless (HAVE_GETFINALPATHNAME , 'need _getfinalpathname' )
778- def test_realpath_permission (self ):
779- # Test whether python can resolve the real filename of a
780- # shortened file name even if it does not have permission to access it.
781- ABSTFN = ntpath .realpath (os_helper .TESTFN )
782-
783- os_helper .unlink (ABSTFN )
784- os_helper .rmtree (ABSTFN )
785- os .mkdir (ABSTFN )
786- self .addCleanup (os_helper .rmtree , ABSTFN )
787-
788- test_file = ntpath .join (ABSTFN , "LongFileName123.txt" )
789- test_file_short = ntpath .join (ABSTFN , "LONGFI~1.TXT" )
790-
791- with open (test_file , "wb" ) as f :
792- f .write (b"content" )
793- # Automatic generation of short names may be disabled on
794- # NTFS volumes for the sake of performance.
795- # They're not supported at all on ReFS and exFAT.
796- p = subprocess .run (
797- # Try to set the short name manually.
798- ['fsutil.exe' , 'file' , 'setShortName' , test_file , 'LONGFI~1.TXT' ],
799- creationflags = subprocess .DETACHED_PROCESS
800- )
801-
802- if p .returncode :
803- raise unittest .SkipTest ('failed to set short name' )
804-
805- try :
806- self .assertPathEqual (test_file , ntpath .realpath (test_file_short ))
807- except AssertionError :
808- raise unittest .SkipTest ('the filesystem seems to lack support for short filenames' )
809-
810- # Deny the right to [S]YNCHRONIZE on the file to
811- # force nt._getfinalpathname to fail with ERROR_ACCESS_DENIED.
812- p = subprocess .run (
813- ['icacls.exe' , test_file , '/deny' , '*S-1-5-32-545:(S)' ],
814- creationflags = subprocess .DETACHED_PROCESS
815- )
816-
817- if p .returncode :
818- raise unittest .SkipTest ('failed to deny access to the test file' )
819-
820- self .assertPathEqual (test_file , ntpath .realpath (test_file_short ))
821-
822777 def test_expandvars (self ):
823778 with os_helper .EnvironmentVarGuard () as env :
824779 env .clear ()
0 commit comments