Skip to content

Commit 07aedeb

Browse files
committed
rimport: Print message about not needing to run relink.py.
1 parent 7880d62 commit 07aedeb

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

rimport

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,11 @@ def main(argv: List[str] | None = None) -> int:
431431
errors += 1
432432
logger.error("%srimport: error processing %s: %s", INDENT, p, e)
433433

434-
return 0 if errors == 0 else 1
434+
if errors:
435+
return 1
436+
if not args.check:
437+
logger.info("\nNo need to run relink.py")
438+
return 0
435439

436440

437441
if __name__ == "__main__":

tests/rimport/test_main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def test_single_file_success(
4141
mock_get_staging_root,
4242
mock_stage_data,
4343
tmp_path,
44+
caplog,
4445
):
4546
"""Test main() logic flow when a single file stages successfully."""
4647
# Setup
@@ -62,6 +63,7 @@ def test_single_file_success(
6263
mock_stage_data.assert_called_once_with(
6364
test_file, inputdata_root, staging_root, False
6465
)
66+
assert "No need to run relink.py" in caplog.text
6567

6668
@patch.object(rimport, "stage_data")
6769
@patch.object(rimport, "get_staging_root")
@@ -153,6 +155,10 @@ def stage_data_side_effect(src, *_args, **_kwargs):
153155
assert "error processing" in captured.err
154156
assert "Test error for file2" in captured.err
155157

158+
# Check that message about not needing to run relink was NOT printed
159+
assert "No need to run relink.py" not in captured.err
160+
assert "No need to run relink.py" not in captured.out
161+
156162
@patch.object(rimport, "ensure_running_as")
157163
def test_nonexistent_inputdata_directory(
158164
self, _mock_ensure_running_as, tmp_path, capsys
@@ -226,6 +232,7 @@ def test_check_mode_calls(
226232
mock_get_staging_root,
227233
mock_stage_data,
228234
tmp_path,
235+
caplog,
229236
):
230237
"""Test that --check mode skips the user check but does call stage_data."""
231238
inputdata_root = tmp_path / "inputdata"
@@ -248,6 +255,8 @@ def test_check_mode_calls(
248255
mock_stage_data.assert_called_once_with(
249256
test_file, inputdata_root, staging_root, True
250257
)
258+
# Message about relink.py should not have been printed
259+
assert "No need to run relink.py" not in caplog.text
251260

252261
@patch.object(rimport, "stage_data")
253262
@patch.object(rimport, "get_staging_root")

0 commit comments

Comments
 (0)