From 4ed36694a7c9a6e8955b45ee274ce0167869da29 Mon Sep 17 00:00:00 2001
From: Marco Matthies <71844+marcom@users.noreply.github.com>
Date: Thu, 25 Jul 2024 16:24:45 +0200
Subject: [PATCH] Re-enable tests that are broken

---
 test/nature_tests.jl                 | 28 ++++++++++++----------------
 test/test_parameters_almass.toml     |  4 ++--
 test/test_parameters_simplecrop.toml |  4 ++--
 3 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/test/nature_tests.jl b/test/nature_tests.jl
index 1cb7747..d38df48 100644
--- a/test/nature_tests.jl
+++ b/test/nature_tests.jl
@@ -249,28 +249,24 @@ end
         end
     end
     # test migration
-    # TODO: fix test below
-    # @test_logs((:info, "Initialised 2 Skylarks."),
-    #            (:debug, "Skylark 1 has migrated."),
-    #            (:debug, "Skylark 2 has migrated."),
-    #            min_level=Logging.Debug, match_mode=:any,
-    #            Ps.initpopulation!("Skylark", Ps.withtestlogger(model)))
-    # TODO: fix broken test
-    @test_broken length(model.animals) == 2
+    @test_logs((:info, "Initialised 2 Skylarks."),
+               (:debug, "Skylark 1 has migrated."),
+               (:debug, "Skylark 2 has migrated."),
+               min_level=Logging.Debug, match_mode=:any,
+               Ps.initpopulation!("Skylark", Ps.withtestlogger(model)))
+    @test length(model.animals) == 2
     @test all(isnothing, model.animals)
-    # TODO: fix broken tests
-    @test_broken length(model.migrants) == 2
-    @test_broken model.migrants[1].first.sex != model.migrants[2].first.sex
+    @test length(model.migrants) == 2
+    @test model.migrants[1].first.sex != model.migrants[2].first.sex
     for a in model.migrants
         leave, arrive = a.first.migrationdates
         @test leave[1] in (9, 10) || (leave[1] == 11 && leave[2] <= 15)
         @test (arrive[1] == 2 && arrive[2] >= 15) || (arrive[1] == 3 && arrive[2] <= 15)
     end
     model.date = Date(year(model.date), 3, 17)
-    # TODO: fix test below
-    # @test_logs((:debug, "Skylark 1 has returned."),
-    #            (:debug, "Skylark 2 has returned."),
-    #            min_level=Logging.Debug, match_mode=:any,
-    #            Ps.updatenature!(Ps.withtestlogger(model)))
+    @test_logs((:debug, "Skylark 1 has returned."),
+               (:debug, "Skylark 2 has returned."),
+               min_level=Logging.Debug, match_mode=:any,
+               Ps.updatenature!(Ps.withtestlogger(model)))
     #TODO
 end
diff --git a/test/test_parameters_almass.toml b/test/test_parameters_almass.toml
index 94d6a9a..1308029 100644
--- a/test/test_parameters_almass.toml
+++ b/test/test_parameters_almass.toml
@@ -4,7 +4,7 @@
 ###
 
 #XXX remember that changes here may break tests!
-	
+
 [core]
 configfile = "test_parameters.toml" # location of the configuration file
 outdir = "results_testsuite" # location and name of the output folder
@@ -36,7 +36,7 @@ targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate
 popoutfreq = "daily" # output frequency population-level data, daily/monthly/yearly/end/never
 indoutfreq = "daily" # output frequency individual-level data, daily/monthly/yearly/end/never
 insectmodel = ["season", "habitat", "pesticides"] # which factors affect insect growth ("weather" is not yet implemented)
-	
+
 [crop]
 cropmodel = "almass" # crop growth model to use, "almass", "aquacrop", or "simple"
 cropfile = "crop_data_general.csv" # file with general crop parameters
diff --git a/test/test_parameters_simplecrop.toml b/test/test_parameters_simplecrop.toml
index c3bfe01..fc199a8 100644
--- a/test/test_parameters_simplecrop.toml
+++ b/test/test_parameters_simplecrop.toml
@@ -4,7 +4,7 @@
 ###
 
 #XXX remember that changes here may break tests!
-	
+
 [core]
 configfile = "test_parameters.toml" # location of the configuration file
 outdir = "results_testsuite" # location and name of the output folder
@@ -36,7 +36,7 @@ targetspecies = ["Wolpertinger", "Wyvern"] # list of target species to simulate
 popoutfreq = "daily" # output frequency population-level data, daily/monthly/yearly/end/never
 indoutfreq = "daily" # output frequency individual-level data, daily/monthly/yearly/end/never
 insectmodel = ["season", "habitat", "pesticides"] # which factors affect insect growth ("weather" is not yet implemented)
-	
+
 [crop]
 cropmodel = "simple" # crop growth model to use, "almass", "aquacrop", or "simple"
 cropfile = "crop_data_general.csv" # file with general crop parameters
-- 
GitLab