From d4b44a9ae2694dbaa14b5ea2ae22faaa5250586b Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Tue, 25 Oct 2022 11:22:09 +0200
Subject: [PATCH] [T] Run notebook tests only once (either in serial or petsc).

---
 ProcessLib/ComponentTransport/Tests.cmake          | 14 ++++++++------
 ProcessLib/SmallDeformation/Tests.cmake            |  8 +++++---
 ProcessLib/TH2M/Tests.cmake                        |  4 +++-
 .../docs/devguide/testing/test-data/index.md       |  6 ++++--
 4 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/ProcessLib/ComponentTransport/Tests.cmake b/ProcessLib/ComponentTransport/Tests.cmake
index cd3919e1fa4..26fd3a4a1b9 100644
--- a/ProcessLib/ComponentTransport/Tests.cmake
+++ b/ProcessLib/ComponentTransport/Tests.cmake
@@ -864,9 +864,11 @@ AddTest(
     classical_transport_example_t_7200.00.vtu classical_transport_example_t_7200.00.vtu velocity velocity 1.e-12 1.0e-12
 )
 
-NotebookTest(NOTEBOOKFILE Parabolic/LiquidFlow/AxiSymTheis/axisym_theis.ipynb RUNTIME 5)
-NotebookTest(NOTEBOOKFILE Parabolic/ComponentTransport/ReactiveTransport/DecayChain/DecayChain.ipynb RUNTIME 160)
-NotebookTest(NOTEBOOKFILE Parabolic/ComponentTransport/ReactiveTransport/RadionuclidesMigration/RadionuclidesMigration.ipynb RUNTIME 55)
-NotebookTest(NOTEBOOKFILE Parabolic/ComponentTransport/MultiLayerDiffusion/MultiLayerDiffusion.ipynb RUNTIME 25)
-NotebookTest(NOTEBOOKFILE Parabolic/ComponentTransport/DiffusionSorptionDecay/DiffusionSorptionDecay.ipynb RUNTIME 16)
-NotebookTest(NOTEBOOKFILE Parabolic/ThermalTwoPhaseFlowPP/HeatPipe/heatpipe.ipynb RUNTIME 10)
+if(NOT OGS_USE_PETSC)
+    NotebookTest(NOTEBOOKFILE Parabolic/LiquidFlow/AxiSymTheis/axisym_theis.ipynb RUNTIME 5)
+    NotebookTest(NOTEBOOKFILE Parabolic/ComponentTransport/ReactiveTransport/DecayChain/DecayChain.ipynb RUNTIME 160)
+    NotebookTest(NOTEBOOKFILE Parabolic/ComponentTransport/ReactiveTransport/RadionuclidesMigration/RadionuclidesMigration.ipynb RUNTIME 55)
+    NotebookTest(NOTEBOOKFILE Parabolic/ComponentTransport/MultiLayerDiffusion/MultiLayerDiffusion.ipynb RUNTIME 25)
+    NotebookTest(NOTEBOOKFILE Parabolic/ComponentTransport/DiffusionSorptionDecay/DiffusionSorptionDecay.ipynb RUNTIME 16)
+    NotebookTest(NOTEBOOKFILE Parabolic/ThermalTwoPhaseFlowPP/HeatPipe/heatpipe.ipynb RUNTIME 10)
+endif()
diff --git a/ProcessLib/SmallDeformation/Tests.cmake b/ProcessLib/SmallDeformation/Tests.cmake
index 6b13a4e2cf4..907a80d3ed4 100644
--- a/ProcessLib/SmallDeformation/Tests.cmake
+++ b/ProcessLib/SmallDeformation/Tests.cmake
@@ -266,6 +266,8 @@ AddTest(
     arehs-salt-M_gravity_only_ts_10_t_31535999999.999996.vtu arehs-salt-M_gravity_only_ts_10_t_31535999999.999996.vtu sigma sigma 1.e-9 5.e-7
 )
 
-NotebookTest(NOTEBOOKFILE Mechanics/Linear/SimpleMechanics.ipynb RUNTIME 5)
-NotebookTest(NOTEBOOKFILE Mechanics/Linear/DiscWithHole/Linear_Disc_with_hole.ipynb RUNTIME 15 RESOURCE_LOCK PYVISTA)
-NotebookTest(NOTEBOOKFILE Mechanics/Linear/DiscWithHole/Linear_Disc_with_hole_convergence_analysis.ipynb RUNTIME 40 RESOURCE_LOCK PYVISTA)
+if(NOT OGS_USE_PETSC)
+    NotebookTest(NOTEBOOKFILE Mechanics/Linear/SimpleMechanics.ipynb RUNTIME 5)
+    NotebookTest(NOTEBOOKFILE Mechanics/Linear/DiscWithHole/Linear_Disc_with_hole.ipynb RUNTIME 15 RESOURCE_LOCK PYVISTA)
+    NotebookTest(NOTEBOOKFILE Mechanics/Linear/DiscWithHole/Linear_Disc_with_hole_convergence_analysis.ipynb RUNTIME 40 RESOURCE_LOCK PYVISTA)
+endif()
diff --git a/ProcessLib/TH2M/Tests.cmake b/ProcessLib/TH2M/Tests.cmake
index b34f8c5d928..e0bae567843 100644
--- a/ProcessLib/TH2M/Tests.cmake
+++ b/ProcessLib/TH2M/Tests.cmake
@@ -415,4 +415,6 @@ AddTest(
     results_heatpipe_strict_ts_23_t_40000_000000_2.vtu results_heatpipe_strict_ts_23_t_40000_000000_2.vtu saturation saturation 1e-9 1e-8
 )
 
-NotebookTest(NOTEBOOKFILE TH2M/TH2/heatpipe/heatpipe.ipynb RUNTIME 140)
+if(NOT OGS_USE_PETSC)
+    NotebookTest(NOTEBOOKFILE TH2M/TH2/heatpipe/heatpipe.ipynb RUNTIME 140)
+endif()
diff --git a/web/content/docs/devguide/testing/test-data/index.md b/web/content/docs/devguide/testing/test-data/index.md
index e5ceae22af2..a96f63d0f61 100644
--- a/web/content/docs/devguide/testing/test-data/index.md
+++ b/web/content/docs/devguide/testing/test-data/index.md
@@ -89,10 +89,12 @@ Add new Python dependencies to `Test/Data/requirements.txt`.
 
 ### Register with CTest
 
-Add the benchmark to CTest with:
+Add the benchmark to CTest with e.g.:
 
 ```cmake
-NotebookTest(NOTEBOOKFILE Mechanics/Linear/SimpleMechanics.ipynb RUNTIME 10)
+if(NOT OGS_USE_PETSC)
+    NotebookTest(NOTEBOOKFILE Mechanics/Linear/SimpleMechanics.ipynb RUNTIME 10)
+endif()
 ```
 
 By registering notebooks [are automatically added]({{< relref "jupyter-docs" >}}) to the benchmark documentation page.
-- 
GitLab