Skip to content

Commit

Permalink
Use IOCapture
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed May 6, 2024
1 parent 4afff85 commit 97c0390
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
8 changes: 1 addition & 7 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.3"
manifest_format = "2.0"
project_hash = "84ca8e19d9af141a7622a8feb4f64903c913b47b"
project_hash = "d0e4a850a649b0ec43008505c69660606862705f"

[[deps.ADTypes]]
git-tree-sha1 = "016833eb52ba2d6bea9fcb50ca295980e728ee24"
Expand Down Expand Up @@ -1529,12 +1529,6 @@ deps = ["Artifacts", "Libdl", "libblastrampoline_jll"]
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
version = "7.2.1+1"

[[deps.Suppressor]]
deps = ["Logging"]
git-tree-sha1 = "9143c41bd539a8885c79728b9dedb0ce47dc9819"
uuid = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
version = "0.2.7"

[[deps.SymbolicIndexingInterface]]
deps = ["Accessors", "ArrayInterface", "MacroTools", "RuntimeGeneratedFunctions", "StaticArraysCore"]
git-tree-sha1 = "7a7be02e16d11c17e2407bab80c2dd1410f774cb"
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
IOCapture = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
Infiltrator = "5903a43b-9cc3-4c30-8d17-598619ec4e9b"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
Expand All @@ -49,7 +50,6 @@ SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
Expand Down
1 change: 0 additions & 1 deletion core/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
IOCapture = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
8 changes: 5 additions & 3 deletions core/test/validation_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,14 @@ end
end

@testitem "Convergence bottleneck" begin
using Suppressor: @capture_out
using IOCapture: capture
toml_path =
normpath(@__DIR__, "../../generated_testmodels/invalid_unstable/ribasim.toml")
@test ispath(toml_path)
output = @capture_out Ribasim.main(toml_path)
output = split(output, "\n")
(; output) = capture() do
Ribasim.main(toml_path)
end
output = split(output, "\n")[(end - 4):end]
@test startswith(
output[1],
"The following basins were identified as convergence bottlenecks",
Expand Down
2 changes: 1 addition & 1 deletion python/ribasim_testmodels/ribasim_testmodels/invalid.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def invalid_unstable_model() -> Model:
Node(1 + id_shift * i, Point(i, 0)),
[basin.Profile(area=1000.0, level=[0.0, 1.0]), basin.State(level=[1.0])],
)
flow_rate = 1.0 if (i % 2 == 0) else 1e15
flow_rate = 1.0 if (i % 2 == 0) else 1e10
model.pump.add(
Node(2 + id_shift * i, Point(i, 1)), [pump.Static(flow_rate=[flow_rate])]
)
Expand Down

0 comments on commit 97c0390

Please sign in to comment.