Skip to content

Commit 70d3eda

Browse files
committed
black -l 120
1 parent ed7e276 commit 70d3eda

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

mergin/client_push.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,12 @@ def _geodiff_changes_count(mp: MerginProject, diff_rel_path: str):
333333

334334
try:
335335
from pygeodiff import GeoDiff, GeoDiffLibError
336+
336337
return GeoDiff().changes_count(diff_abs)
337338
except GeoDiffLibError:
338339
return None
339340

341+
340342
def push_project_cancel(job):
341343
"""
342344
To be called (from main thread) to cancel a job that has uploads in progress.

mergin/test/test_push_logging.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from mergin.client_push import push_project_finalize, UploadJob
99
from mergin.common import ClientError
1010

11+
1112
@pytest.mark.parametrize("status_code", [502, 504])
1213
def test_push_finalize_logs_on_5xx_real_diff(caplog, status_code, tmp_path):
1314
# --- data ---
@@ -30,17 +31,26 @@ def test_push_finalize_logs_on_5xx_real_diff(caplog, status_code, tmp_path):
3031

3132
# --- fake MP/MC len tam, kde treba ---
3233
class MP:
33-
def __init__(self, log): self.log = log
34-
def update_metadata(self, *a, **k): pass
35-
def apply_push_changes(self, *a, **k): pass
36-
def fpath_meta(self, rel): return str(diff_path) if rel == diff_path.name else rel
34+
def __init__(self, log):
35+
self.log = log
36+
37+
def update_metadata(self, *a, **k):
38+
pass
39+
40+
def apply_push_changes(self, *a, **k):
41+
pass
42+
43+
def fpath_meta(self, rel):
44+
return str(diff_path) if rel == diff_path.name else rel
3745

3846
tx = "tx-1"
3947

4048
class MC:
4149
def post(self, url, *args, **kwargs):
4250
if url.endswith(f"/v1/project/push/finish/{tx}"):
43-
err = ClientError("Gateway error"); setattr(err, "http_error", status_code); raise err
51+
err = ClientError("Gateway error")
52+
setattr(err, "http_error", status_code)
53+
raise err
4454
if url.endswith(f"/v1/project/push/cancel/{tx}"):
4555
return SimpleNamespace(msg="cancelled")
4656
return SimpleNamespace(msg="ok")
@@ -52,12 +62,14 @@ def post(self, url, *args, **kwargs):
5262
project_path="u/p",
5363
changes={
5464
"added": [],
55-
"updated": [{
56-
"path": modified.name,
57-
"size": file_size,
58-
"diff": {"path": diff_path.name, "size": diff_size},
59-
"chunks": [1],
60-
}],
65+
"updated": [
66+
{
67+
"path": modified.name,
68+
"size": file_size,
69+
"diff": {"path": diff_path.name, "size": diff_size},
70+
"chunks": [1],
71+
}
72+
],
6173
"removed": [],
6274
},
6375
transaction_id=tx,
@@ -84,4 +96,4 @@ def post(self, url, *args, **kwargs):
8496
assert modified.name in text
8597
assert f"size={file_size}" in text
8698
assert f"diff_size={diff_size}" in text
87-
assert ("changes=" in text) or ("changes=n/a" in text)
99+
assert ("changes=" in text) or ("changes=n/a" in text)

0 commit comments

Comments
 (0)