Skip to content

Commit 6473167

Browse files
Direct all print messages to stderr
1 parent 1348b1e commit 6473167

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

fixity/fixity.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ def scanall(
254254
except Exception as e:
255255
utils.pyprint(
256256
f"Internal error encountered while scanning AIP {aip['uuid']} ({type(e).__name__})",
257-
file=sys.stdout,
258257
timestamps=timestamps,
259258
)
260259
if throttle_time:

fixity/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ def format_timestamp(t):
4343
def pyprint(message, **kwargs):
4444
if kwargs.get("timestamps"):
4545
message = f"[{format_timestamp(utcnow())}] {message}"
46-
print(message, file=kwargs.get("file", sys.stderr))
46+
print(message, file=sys.stderr)

tests/test_fixity.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,10 @@ def test_scanall_handles_exceptions(_get, capsys):
421421
assert response is False
422422

423423
captured = capsys.readouterr()
424-
assert (
425-
captured.out.strip()
426-
== "Internal error encountered while scanning AIP 77adb748-8d9c-47ec-b593-53465749ce0e (StorageServiceError)"
427-
)
428424

429425
assert captured.err.strip() == "\n".join(
430426
[
427+
"Internal error encountered while scanning AIP 77adb748-8d9c-47ec-b593-53465749ce0e (StorageServiceError)",
431428
f'Storage service at "{STORAGE_SERVICE_URL}" failed authentication while scanning AIP 32f62f8b-ecfd-419e-a3e9-911ec23d0573',
432429
"Successfully scanned 2 AIPs",
433430
]
@@ -509,12 +506,10 @@ def test_main_handles_exceptions_if_scanall_fails(_get, monkeypatch, capsys):
509506
assert result == 1
510507

511508
captured = capsys.readouterr()
512-
assert (
513-
captured.out.strip()
514-
== f"Internal error encountered while scanning AIP {aip_id} (StorageServiceError)"
515-
)
509+
assert captured.out.strip() == ""
516510
assert captured.err.strip() == "\n".join(
517511
[
512+
f"Internal error encountered while scanning AIP {aip_id} (StorageServiceError)",
518513
f'Storage service at "{STORAGE_SERVICE_URL}" failed authentication while scanning AIP 32f62f8b-ecfd-419e-a3e9-911ec23d0573',
519514
"Successfully scanned 2 AIPs",
520515
]

0 commit comments

Comments
 (0)