Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-2498

[macOS] Fix test_local_rename() from test_special_characters.py

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.5.0
    • Fix Version/s: None
    • Component/s: Tests

      Description

      The test is failing every time:

      $ python -m pytest -n0 tests/old_functional/test_special_characters.py::TestSpecialCharacters::test_rename_local
      
          @not_windows(reason="Explorer prevents using those characters")
          def test_rename_local(self):
              local = self.local_1
              remote = self.remote_1
          
              self.engine_1.start()
              self.wait_sync(wait_for_async=True)
          
              folder_name = "abcd"
              file_name = "efgh.txt"
              folder = local.make_folder("/", folder_name)
              local.make_file(folder, file_name, content=b"This is a test file")
          
              self.wait_sync()
              assert remote.exists(f"/{folder_name}")
              assert remote.exists(f"/{folder_name}/{file_name}")
          
              new_folder_name = "/ * ? < > |"
              new_folder_name_expected = "- - - - - -"
              new_file_name = "| > < ? * /.txt"
              new_file_name_expected = "- - - - - -.txt"
      >       local.rename(f"/{folder_name}", new_folder_name)
      
      file_name  = 'efgh.txt'
      folder     = PosixPath('abcd')
      folder_name = 'abcd'
      local      = <MacLocalClient base_folder=PosixPath('/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662'), is_case_sensitive=None>
      new_file_name = '| > < ? * /.txt'
      new_file_name_expected = '- - - - - -.txt'
      new_folder_name = '/ * ? < > |'
      new_folder_name_expected = '- - - - - -'
      remote     = <RemoteBase args=None, kwargs=None, upload_tmp_dir=PosixPath('/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/uploads')>
      self       = <tests.old_functional.test_special_characters.TestSpecialCharacters testMethod=test_rename_local>
      
      tests/old_functional/test_special_characters.py:63: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      self = <MacLocalClient base_folder=PosixPath('/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662'), is_case_sensitive=None>
      srcref = '/abcd', to_name = '/ * ? < > |'
      
          def rename(self, srcref: str, to_name: str):
              parent = os.path.dirname(srcref)
              dstref = os.path.join(parent)
      >       self.move(srcref, dstref, name=to_name)
      
      dstref     = '/'
      parent     = '/'
      self       = <MacLocalClient base_folder=PosixPath('/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662'), is_case_sensitive=None>
      srcref     = '/abcd'
      to_name    = '/ * ? < > |'
      
      tests/old_functional/local_client_darwin.py:52: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      self = <MacLocalClient base_folder=PosixPath('/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662'), is_case_sensitive=None>
      srcref = '/abcd', parentref = '/', name = '/ * ? < > |'
      
          def move(self, srcref: str, parentref: str, name: str = None) -> None:
              src = self.abspath(srcref)
              parent = self.abspath(parentref)
          
              dst = parent / (name or src.name)
          
              error = None
              result = self.fm.moveItemAtPath_toPath_error_(str(src), str(dst), error)
              time.sleep(0.3)
      >       self._process_result(result)
      
      dst        = PosixPath('/ * ? < > |')
      error      = None
      name       = '/ * ? < > |'
      parent     = PosixPath('/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662')
      parentref  = '/'
      result     = (False,
       Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is read only." UserInfo={NSDestinationFilePath=/ * ? < > |, NSUserStringVariant=Move, NSFilePath=/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662/abcd, NSUnderlyingError=0x7fc4074080c0 {Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is read only." UserInfo={NSSourceFilePathErrorKey=/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662/abcd, NSUserStringVariant=(
          Copy
      ), NSDestinationFilePath=/ * ? < > |, NSFilePath=/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662/abcd, NSUnderlyingError=0x7fc407408ca0 {Error Domain=NSPOSIXErrorDomain Code=30 "Read-only file system"}}}})
      self       = <MacLocalClient base_folder=PosixPath('/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662'), is_case_sensitive=None>
      src        = PosixPath('/private/var/folders/zg/vkhwn19d0cz9vvq_t8rwq68c0000gn/T/85cd0ea0/1/drive/test_rename_local-darwin-77662/abcd')
      srcref     = '/abcd'
      
      tests/old_functional/local_client_darwin.py:47: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      result = (False, Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “abcd” because the volume “Macintosh HD” is ...rwin-77662/abcd, NSUnderlyingError=0x7fc407408ca0 {Error Domain=NSPOSIXErrorDomain Code=30 "Read-only file system"}}}})
      
          @staticmethod
          def _process_result(result):
              ok, err = result
              if not ok:
                  error = (
                      f"{err.localizedDescription()} (cause: {err.localizedFailureReason()})"
                  )
      >           raise OSError(error)
      E           OSError: You can’t save the file “abcd” because the volume “Macintosh HD” is read only. (cause: The volume “Macintosh HD” is read only.)
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 5 minutes
                  5m