Repository: parflow/parflow (language: python)

Issue:
Python regression tests and optional dependencies
The Python regression tests are not checking if optional packages (hypre, silo etc) are installed when running the regression tests.   Looks like all tests are always being run which results in failures when optional packages are not present.


Discussion / hints:

Fix patch:
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index f897d356d..e47c4d1f8 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -10,6 +10,7 @@ ParFlow development and bug-fixes would not be possible without contributions of
 * Documentation updates
 * 
 
+
 ## User Visible Changes
 
 ### DockerHub Container has Python and TCL support.


Test patch:
diff --git a/test/python/CMakeLists.txt b/test/python/CMakeLists.txt
index 3484c3aac..a546a44e3 100644
--- a/test/python/CMakeLists.txt
+++ b/test/python/CMakeLists.txt
@@ -89,12 +89,16 @@ if ( ${PARFLOW_AMPS_LAYER} IN_LIST PARFLOW_AMPS_LAYER_REQUIRE_MPI )
     list(APPEND PARALLEL_2DTOPO_TESTS
       default_overland
       default_overland.pfmg.jac
-      default_overland.pfmg_octree.jac
       default_overland.pfmg_octree.fulljac
       LW_var_dz
       LW_var_dz_spinup
       overland_slopingslab_KWE
       richards_box_proctest_vardz)
+
+    if(${PARFLOW_HAVE_SILO})
+      list(APPEND PARALLEL_2DTOPO_TESTS
+	default_overland.pfmg_octree.jac)
+    endif()
   endif()
 
 endif()
diff --git a/test/python/clm/CMakeLists.txt b/test/python/clm/CMakeLists.txt
index 5207b43fe..8aca591f4 100644
--- a/test/python/clm/CMakeLists.txt
+++ b/test/python/clm/CMakeLists.txt
@@ -1,17 +1,24 @@
 include(ParflowTest)
 
-if(PARFLOW_HAVE_CLM OR DEFINED ENV{PARFLOW_DIR})
-  set(CLM_TESTS
-    clm-reuse
-  )
-  set(CLM_2D_TESTS
-    clm
-    clm_varDZ
-    clm.jac
-    clm_forc_veg
-    clm_4levels
-    clm_slope
-  )
+set(CLM_TESTS)
+set(CLM_2D_TESTS)
+
+if (${PARFLOW_HAVE_CLM})
+  if (${PARFLOW_HAVE_HYPRE})
+    list(APPEND CLM_TESTS
+      clm-reuse)
+
+    list(APPEND CLM_2D_TESTS
+      clm_slope)
+    if (${PARFLOW_HAVE_SILO})
+      list(APPEND CLM_2D_TESTS
+	clm
+	clm_varDZ
+	clm.jac
+	clm_forc_veg
+	clm_4levels)
+    endif()
+  endif()
 endif()
 
 
@@ -29,4 +36,4 @@ foreach(inputfile ${CLM_2D_TESTS})
   pf_add_py_parallel_test(${inputfile} 2 2 1)
   pf_add_py_parallel_test(${inputfile} 3 3 1)
   pf_add_py_parallel_test(${inputfile} 4 4 1)
-endforeach()
\ No newline at end of file
+endforeach()
diff --git a/test/python/new_features/CMakeLists.txt b/test/python/new_features/CMakeLists.txt
index 58a229135..87c02ebd9 100644
--- a/test/python/new_features/CMakeLists.txt
+++ b/test/python/new_features/CMakeLists.txt
@@ -19,16 +19,22 @@ set(TESTS
   # pfb_mask
   pfidb_pfset
   pfset_test
-  prefix_naming
   selection_methods
-  serial_runs
-  simple-mask
   write_check
   tables_LW
 )
 
+if(${PARFLOW_HAVE_HYPRE})
+  list(APPEND TESTS
+    prefix_naming
+    serial_runs
+    simple-mask)
+endif()
+
 foreach(inputfile ${TESTS})
   pf_add_py_test(${inputfile})
 endforeach()
 
-add_subdirectory(clm)
+if (${PARFLOW_HAVE_CLM})
+  add_subdirectory(clm)
+endif(${PARFLOW_HAVE_CLM})
diff --git a/test/python/new_features/clm/CMakeLists.txt b/test/python/new_features/clm/CMakeLists.txt
index 96f4a55b8..6b8353f90 100644
--- a/test/python/new_features/clm/CMakeLists.txt
+++ b/test/python/new_features/clm/CMakeLists.txt
@@ -1,9 +1,12 @@
 include(ParflowTest)
 
-set(TESTS
-  washita
-  washita_clm_keys
-)
+set(TESTS)
+
+if (${PARFLOW_HAVE_HYPRE})
+  list(APPEND TESTS
+    washita
+    washita_clm_keys)
+endif()
 
 foreach(inputfile ${TESTS})
   pf_add_py_test(${inputfile})