Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Jan 9, 2024
1 parent 7c0e728 commit 91c58c6
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 19 deletions.
11 changes: 5 additions & 6 deletions nxdrive/engine/workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Check warning on line 200 in nxdrive/engine/workers.py

View check run for this annotation

Codecov / codecov/patch

nxdrive/engine/workers.py#L196-L200

Added lines #L196 - L200 were not covered by tests
finally:
self.quit()
self._running = False
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_remote_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions tests/functional/test_remote_client_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_shared_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions tests/functional/test_watchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 91c58c6

Please sign in to comment.