suppress log messages for tests
All checks were successful
Generic zig build / build (push) Successful in 6m12s
Generic zig build / publish-macos (push) Successful in 11s
Generic zig build / deploy (push) Successful in 17s

This commit is contained in:
Emil Lerch 2026-09-30 10:57:15 -07:00
parent 1a9a27156b
commit 8566e7c0bd
Signed by: lobo
GPG key ID: A7B62D657EF764F8
2 changed files with 7 additions and 2 deletions

View file

@ -247,6 +247,7 @@
//! decided from the Lot.maturity_date field, not from the file's form.
const std = @import("std");
const builtin = @import("builtin");
const zfin = @import("../root.zig");
const cli = @import("common.zig");
const git = @import("../git.zig");
@ -732,7 +733,9 @@ fn loadDividendCredits(
for (holdings) |h| {
if (divs.contains(h.symbol)) continue;
fetchDividendsInto(arena, svc, &divs, h.symbol, fetch_opts) catch |err| {
std.log.scoped(.contributions).warn("{s}: dividends unavailable ({t}); a dividend it paid into {s} will count as a contribution", .{ h.symbol, err, h.account });
// The degradation test reaches this on purpose and asserts the
// outcome instead.
if (!builtin.is_test) std.log.scoped(.contributions).warn("{s}: dividends unavailable ({t}); a dividend it paid into {s} will count as a contribution", .{ h.symbol, err, h.account });
};
}
return dividendCredits(arena, holdings, w, &divs);

View file

@ -756,7 +756,9 @@ pub const DataService = struct {
// collapsing it, and do not negative-cache - nothing is
// wrong with the symbol.
if (err == DataError.NoApiKey) {
log.warn("{s}: {s} unavailable: no API key configured", .{ symbol, @tagName(data_type) });
// Tests reach this on purpose - there is no key in the test
// environment - and assert the typed error instead.
if (!builtin.is_test) log.warn("{s}: {s} unavailable: no API key configured", .{ symbol, @tagName(data_type) });
return DataError.NoApiKey;
}
// Only NotFound (provider says "this symbol genuinely has