diff --git a/nxdrive/engine/workers.py b/nxdrive/engine/workers.py index 77e014fc3c..65d90e0462 100644 --- a/nxdrive/engine/workers.py +++ b/nxdrive/engine/workers.py @@ -193,12 +193,11 @@ def run(self) -> None: self.thread_id = current_thread_id() try: - try: - self._execute() - except ThreadInterrupt: - log.debug("Thread INTERRUPT") - except Exception: - log.exception("Thread EXCEPTION") + self._execute() + except ThreadInterrupt: + log.debug("Thread INTERRUPT") + except Exception: + log.exception("Thread EXCEPTION") finally: self.quit() self._running = False diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 01037722c4..6a9634c22b 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -848,7 +848,7 @@ def generate_report(self, exceptions: List[Exception]) -> None: self.manager_1.generate_report(path=self._get_report_file()) def _set_read_permission(self, user, doc_path, grant): - input_obj = "doc:" + doc_path + input_obj = f"doc:{doc_path}" remote = self.root_remote if grant: remote.execute( @@ -881,7 +881,7 @@ def set_readonly(self, user: str, doc_path: str, grant: bool = True): :param grant: Set RO if True else RW. """ remote = self.root_remote - input_obj = "doc:" + doc_path + input_obj = f"doc:{doc_path}" if grant: remote.execute( command="Document.SetACE", diff --git a/tests/functional/test_remote_client.py b/tests/functional/test_remote_client.py index 23fe830a7c..dedaf3fb5c 100644 --- a/tests/functional/test_remote_client.py +++ b/tests/functional/test_remote_client.py @@ -507,7 +507,7 @@ def mocked_move(*args, **kwargs): dummy_file_path = env.WS_DIR - dummy_file_path = str(env.WS_DIR) + "#" + dummy_file_path = f"{str(env.WS_DIR)}#" with patch.object( remote, diff --git a/tests/functional/test_remote_client_old.py b/tests/functional/test_remote_client_old.py index 7dbcb7d965..50a30080fc 100644 --- a/tests/functional/test_remote_client_old.py +++ b/tests/functional/test_remote_client_old.py @@ -67,7 +67,7 @@ def test_get_fs_info(self): assert info.download_url is None # Check non existing file info - fs_item_id = FS_ITEM_ID_PREFIX + "fakeId" + fs_item_id = f"{FS_ITEM_ID_PREFIX}fakeId" with pytest.raises(NotFound): remote.get_fs_info(fs_item_id) @@ -185,10 +185,10 @@ def test_scroll_descendants(self): ) assert isinstance(scroll_res, dict) scroll_id = scroll_res["scroll_id"] - partial_descendants = scroll_res["descendants"] - if not partial_descendants: + if partial_descendants := scroll_res["descendants"]: + descendants.extend(partial_descendants) + else: break - descendants.extend(partial_descendants) descendants = sorted(descendants, key=operator.attrgetter("name")) assert len(descendants) == 4 @@ -312,7 +312,7 @@ def test_exists(self): assert remote.fs_exists(fs_item_id) # Check non existing file system item (non existing document) - fs_item_id = FS_ITEM_ID_PREFIX + "fakeId" + fs_item_id = f"{FS_ITEM_ID_PREFIX}fakeId" assert not remote.fs_exists(fs_item_id) # Check non existing file system item (document without content) @@ -353,7 +353,7 @@ def test_get_fs_item(self): assert fs_item["folder"] # Check non existing file system item - fs_item_id = FS_ITEM_ID_PREFIX + "fakeId" + fs_item_id = f"{FS_ITEM_ID_PREFIX}fakeId" assert remote.get_fs_item(fs_item_id) is None def test_streaming_upload(self): diff --git a/tests/functional/test_shared_folders.py b/tests/functional/test_shared_folders.py index 26c5555316..2f1b6b74be 100644 --- a/tests/functional/test_shared_folders.py +++ b/tests/functional/test_shared_folders.py @@ -29,7 +29,7 @@ def test_move_sync_root_child_to_user_workspace(self): parent_uid = remote_1.make_folder(uid, "Parent") # As user1 grant Everything permission to user2 on parent folder - input_obj = "doc:" + parent_uid + input_obj = f"doc:{parent_uid}" self.root_remote.execute( command="Document.SetACE", input_obj=input_obj, diff --git a/tests/functional/test_watchers.py b/tests/functional/test_watchers.py index 0d5448451a..9ed2a7e8a5 100644 --- a/tests/functional/test_watchers.py +++ b/tests/functional/test_watchers.py @@ -102,9 +102,7 @@ def test_reconcile_scan(self): assert item.pair_state == "synchronized" def test_remote_scan(self): - total = len(self.make_server_tree()) - # Add the workspace folder + the root - total += 2 + total = len(self.make_server_tree()) + 2 # Wait for ES indexing self.wait() self.queue_manager_1.suspend()