diff --git a/ProcessLib/HeatTransportBHE/Tests.cmake b/ProcessLib/HeatTransportBHE/Tests.cmake
index 8767b1eb41e5d41ae34b5675be1b012dfadc6bb7..ad9a21f086e3b77f34036c94f6707fe8f8609014 100644
--- a/ProcessLib/HeatTransportBHE/Tests.cmake
+++ b/ProcessLib/HeatTransportBHE/Tests.cmake
@@ -92,7 +92,7 @@ AddTest(
     WRAPPER time
     TESTER vtkdiff
     REQUIREMENTS OGS_USE_PYTHON AND NOT OGS_USE_MPI AND (${Python3_VERSION} VERSION_LESS 3.9)
-    PYTHON_PACKAGES TESPy=0.3.2 --python ">=3.6,<3.9"
+    PYTHON_PACKAGES "TESPy=0.3.2 --python \">=3.6,<3.9\""
     DIFF_DATA
     3bhes_1U_ts_10_t_600.000000.vtu 3bhes_1U_ts_10_t_600.000000.vtu temperature_soil temperature_soil 1e-12 1e-13
     3bhes_1U_ts_10_t_600.000000.vtu 3bhes_1U_ts_10_t_600.000000.vtu temperature_BHE1 temperature_BHE1 1e-10 1e-13
diff --git a/scripts/cmake/test/AddTest.cmake b/scripts/cmake/test/AddTest.cmake
index 08dfceda927b57193733d9a02530994796ae57ca..ddca63d31ba75ca547180151583b7031f110e9e7 100644
--- a/scripts/cmake/test/AddTest.cmake
+++ b/scripts/cmake/test/AddTest.cmake
@@ -292,10 +292,15 @@ Use six arguments version of AddTest with absolute and relative tolerances")
 
     if(AddTest_PYTHON_PACKAGES)
         if(POETRY)
+            file(WRITE ${PROJECT_BINARY_DIR}/tmp_poetry_add.bat "poetry add ${AddTest_PYTHON_PACKAGES}")
+            if(WIN32)
+                set(EXEC_CMD tmp_poetry_add.bat)
+            else()
+                set(EXEC_CMD ${BASH_TOOL_PATH} tmp_poetry_add.bat)
+            endif()
             execute_process(
-                COMMAND ${CMD_COMMAND} poetry add ${AddTest_PYTHON_PACKAGES}
-                WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
-            )
+                    COMMAND ${EXEC_CMD}
+                    WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
         else()
             message(STATUS "Warning: Benchmark ${AddTest_NAME} requires these "
                 "Python packages: ${AddTest_PYTHON_PACKAGES}!\n Make sure to "