From 97c03907d06004dadce63830e98f82908a89b84a Mon Sep 17 00:00:00 2001
From: Bart de Koning <bart.dekoning@deltares.nl>
Date: Mon, 6 May 2024 17:18:34 +0200
Subject: [PATCH] Use IOCapture

---
 Manifest.toml                                           | 8 +-------
 Project.toml                                            | 2 +-
 core/Project.toml                                       | 1 -
 core/test/validation_test.jl                            | 8 +++++---
 python/ribasim_testmodels/ribasim_testmodels/invalid.py | 2 +-
 5 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/Manifest.toml b/Manifest.toml
index e0fdd2ed2..c75356163 100644
--- a/Manifest.toml
+++ b/Manifest.toml
@@ -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"
@@ -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"
diff --git a/Project.toml b/Project.toml
index c6c801cea..32713b69d 100644
--- a/Project.toml
+++ b/Project.toml
@@ -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"
@@ -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"
diff --git a/core/Project.toml b/core/Project.toml
index 89b1945a9..4d7b647a2 100644
--- a/core/Project.toml
+++ b/core/Project.toml
@@ -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"
diff --git a/core/test/validation_test.jl b/core/test/validation_test.jl
index 300bf4036..a15c3f037 100644
--- a/core/test/validation_test.jl
+++ b/core/test/validation_test.jl
@@ -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",
diff --git a/python/ribasim_testmodels/ribasim_testmodels/invalid.py b/python/ribasim_testmodels/ribasim_testmodels/invalid.py
index 8a082cd4a..0e4f9c315 100644
--- a/python/ribasim_testmodels/ribasim_testmodels/invalid.py
+++ b/python/ribasim_testmodels/ribasim_testmodels/invalid.py
@@ -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])]
         )