Skip to content

Commit c5114a7

Browse files
committed
Account for recv being in rsync output instead of send
Apparently sometimes local transfers can happen in "pull" mode instead of "push" mode
1 parent 765e36d commit c5114a7

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

cylc/flow/scripts/reinstall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def format_reinstall_output(out: str) -> List[str]:
347347
# file is present.
348348
# Skip this line as nothing will happen to this dir.
349349
continue
350-
match = re.match(r'^(.{11}) (send|del\.) (.*)$', line)
350+
match = re.match(r'^(.{11}) (send|del\.|recv) (.*)$', line)
351351
if match:
352352
summary, operation, file = match.groups()
353353
color = 'green' if operation == 'send' else 'red'

tests/integration/test_reinstall.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
import asyncio
2020
from contextlib import asynccontextmanager
2121
from pathlib import Path
22+
import re
2223
from secrets import token_hex
2324
from types import SimpleNamespace
2425

26+
from ansimarkup import strip as cstrip
2527
import pytest
2628

2729
from cylc.flow.exceptions import WorkflowFilesError
@@ -45,6 +47,12 @@
4547
# workflow_running: yes no
4648

4749

50+
@pytest.fixture(autouse=True)
51+
def color_strip(monkeypatch: pytest.MonkeyPatch):
52+
"""Strip colour as the normal colour stripping doesn't apply to tests."""
53+
monkeypatch.setattr('cylc.flow.scripts.reinstall.cparse', cstrip)
54+
55+
4856
@pytest.fixture
4957
def interactive(monkeypatch):
5058
monkeypatch.setattr(
@@ -312,7 +320,6 @@ async def test_permissions_change(
312320
one_run,
313321
interactive,
314322
answer_prompt,
315-
monkeypatch: pytest.MonkeyPatch,
316323
capsys: pytest.CaptureFixture,
317324
):
318325
"""It detects permissions changes."""
@@ -333,7 +340,8 @@ async def test_permissions_change(
333340
opts=ReInstallOptions(), workflow_id=one_run.id
334341
)
335342
out, _ = capsys.readouterr()
336-
assert "send myscript" in out
343+
# On some systems may get "recv" instead of "send"
344+
assert re.search(r'(send|recv) myscript\n', out)
337345

338346

339347
@pytest.fixture

0 commit comments

Comments
 (0)