diff --git a/.github/workflows/pcloud-test.yml b/.github/workflows/pcloud-test.yml index b5a0449..802c557 100644 --- a/.github/workflows/pcloud-test.yml +++ b/.github/workflows/pcloud-test.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: PyCloud package tests & linting +name: PCloud API Python package tests & linting on: push: @@ -17,7 +17,7 @@ jobs: python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] max-parallel: 1 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup firefox @@ -40,7 +40,7 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest src --cov=src/pcloud --cov-report=xml --cov-branch --cov-config=.coveragerc --capture=no -v --timeout=600 --reruns 3 --reruns-delay 3 + pytest src --cov=src/pcloud --cov-report=xml --cov-branch --cov-config=.coveragerc --capture=no -v --timeout=600 --reruns 3 --reruns-delay 5 env: PCLOUD_USERNAME: ${{ secrets.PCLOUD_USERNAME }} PCLOUD_PASSWORD: ${{ secrets.PCLOUD_PASSWORD }} diff --git a/src/pcloud/api.py b/src/pcloud/api.py index 486e060..bc47a48 100644 --- a/src/pcloud/api.py +++ b/src/pcloud/api.py @@ -530,4 +530,5 @@ def trash_restorepath(self, **kwargs): def trash_restore(self, **kwargs): raise NotImplementedError + # EOF diff --git a/src/pcloud/pcloudfs.py b/src/pcloud/pcloudfs.py index 9c2e7e4..37c146f 100644 --- a/src/pcloud/pcloudfs.py +++ b/src/pcloud/pcloudfs.py @@ -310,7 +310,7 @@ def on_close(pcloudfile): if dir_path != "/": self.getinfo(path=dir_path) try: - info = self.getinfo(path, namespaces=['details']) + info = self.getinfo(path, namespaces=["details"]) except errors.ResourceNotFound: pass else: @@ -326,13 +326,13 @@ def on_close(pcloudfile): fd = resp.get("fd") if fd is not None: data = self.pcloud.file_read(fd=fd, count=info.size) - if resp.get('result') != 0: - api.log.error(f'Error reading file {_path} failed with {resp}') + if resp.get("result") != 0: + api.log.error(f"Error reading file {_path} failed with {resp}") pcloud_file.seek(0, os.SEEK_END) pcloud_file.raw.write(data) resp = self.pcloud.file_close(fd=fd) else: - api.log.error(f'No open file found to write. {resp}') + api.log.error(f"No open file found to write. {resp}") return pcloud_file @@ -344,13 +344,13 @@ def on_close(pcloudfile): resp = self.pcloud.file_open(path=_path, flags=api.O_WRITE) fd = resp.get("fd") if fd is None: - api.log.error(f'Error opening file {_path} failed with {resp}') + api.log.error(f"Error opening file {_path} failed with {resp}") else: data = self.pcloud.file_read(fd=fd, count=info.size) pcloud_file.raw.write(data) resp = self.pcloud.file_close(fd=fd) - if resp.get('result') != 0: - api.log.error(f'Error closing file {_path} failed with {resp}') + if resp.get("result") != 0: + api.log.error(f"Error closing file {_path} failed with {resp}") pcloud_file.seek(0) return pcloud_file @@ -391,6 +391,7 @@ def removetree(self, dir_path): if resp["result"] != 0: api.log.error(f"Recurrsive removing of folder {_path} failed {resp}") + class PCloudOpener(Opener): protocols = ["pcloud"]