diff --git a/Tests/Functional/Python/PyCore/CMakeLists.txt b/Tests/Functional/Python/PyCore/CMakeLists.txt
index 2aec5681bc9cc5753126d48497de7b9333a0a94f..c7b1d79d16343e901daa1efcf045d46a164027aa 100644
--- a/Tests/Functional/Python/PyCore/CMakeLists.txt
+++ b/Tests/Functional/Python/PyCore/CMakeLists.txt
@@ -2,7 +2,7 @@
 # Tests/Functional/PyCore/scripts/CMakeLists.txt
 ############################################################################
 
-set(OUTPUT_DIR ${TEST_OUTPUT_DIR}/Python/PyCore)
+set(OUTPUT_DIR ${TEST_OUTPUT_DIR_PY_CORE})
 file(MAKE_DIRECTORY ${OUTPUT_DIR})
 
 set(PYCORE_REFERENCE_DIR ${TEST_REFERENCE_DIR}/Python)
diff --git a/Tests/Functional/Python/PyExamples/CMakeLists.txt b/Tests/Functional/Python/PyExamples/CMakeLists.txt
index e9ccbfb0e29e3d715134e10b22335462e94403ae..12014add4e6127819e9ae55beeaae135fe2f3c69 100644
--- a/Tests/Functional/Python/PyExamples/CMakeLists.txt
+++ b/Tests/Functional/Python/PyExamples/CMakeLists.txt
@@ -5,7 +5,7 @@
 #
 ###############################################################################
 
-set(output_dir ${TEST_OUTPUT_DIR}/Functional/Python/PyExamples)
+set(output_dir ${TEST_OUTPUT_DIR_PY_EXAMPLES})
 file(MAKE_DIRECTORY ${output_dir})
 
 file(GLOB sim_examples "${PY_EXAMPLES_DIR}/sim*/*.py")
diff --git a/Tests/Functional/Python/PyPersistence/CMakeLists.txt b/Tests/Functional/Python/PyPersistence/CMakeLists.txt
index a6ffbc812395d330c5123f8b097d2a5d525124a5..db85f10cc11b671b83ed4d7f9e87cc71d36240f7 100644
--- a/Tests/Functional/Python/PyPersistence/CMakeLists.txt
+++ b/Tests/Functional/Python/PyPersistence/CMakeLists.txt
@@ -2,7 +2,7 @@
 # Tests/Functional/PyCore/persistence/CMakeLists.txt
 ############################################################################
 
-set(OUTPUT_DIR ${TEST_OUTPUT_DIR}/Functional/Python/PyPersist)
+set(OUTPUT_DIR ${TEST_OUTPUT_DIR_PY_PERSIST}/PyPersist)
 file(MAKE_DIRECTORY ${OUTPUT_DIR})
 
 set(PYPERSIST_REFERENCE_DIR ${TEST_REFERENCE_DIR}/Python)
diff --git a/Tests/Functional/Python/Std/CMakeLists.txt b/Tests/Functional/Python/Std/CMakeLists.txt
index d769218f987144295b1a50d828d89273a1b23ba0..afc25e554a52dbd824b7f1240969225cb007e278 100644
--- a/Tests/Functional/Python/Std/CMakeLists.txt
+++ b/Tests/Functional/Python/Std/CMakeLists.txt
@@ -12,4 +12,4 @@ target_link_libraries(${test} BornAgainCore gtest)
 
 gtest_discover_tests(${test} DISCOVERY_TIMEOUT 300 TEST_PREFIX Py.)
 
-file(MAKE_DIRECTORY ${TEST_OUTPUT_DIR}/Functional/Python/Std)
+file(MAKE_DIRECTORY ${TEST_OUTPUT_DIR_PY_STD})
diff --git a/cmake/BornAgain/Directories.cmake b/cmake/BornAgain/Directories.cmake
index 330836505a5d8bc908abc9862ca0f530d2ed9a36..8eab1b847e5b5c3576888c1651ec306b58327a28 100644
--- a/cmake/BornAgain/Directories.cmake
+++ b/cmake/BornAgain/Directories.cmake
@@ -26,7 +26,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
 set(BUILD_VAR_DIR ${CMAKE_BINARY_DIR}/var)
 set(BUILD_INC_DIR ${CMAKE_BINARY_DIR}/inc)
 set(BUILD_SRC_DIR ${CMAKE_BINARY_DIR}/src)
+
 set(TEST_OUTPUT_DIR ${CMAKE_BINARY_DIR}/test_output)
+set(TEST_OUTPUT_DIR_CORE ${CMAKE_BINARY_DIR}/test_output/Core)
+set(TEST_OUTPUT_DIR_PY_EXAMPLES ${CMAKE_BINARY_DIR}/test_output/PyExamples)
+set(TEST_OUTPUT_DIR_PY_CORE ${CMAKE_BINARY_DIR}/test_output/PyCore)
+set(TEST_OUTPUT_DIR_PY_PERSIST ${CMAKE_BINARY_DIR}/test_output/PyPersist)
+set(TEST_OUTPUT_DIR_PY_STD ${CMAKE_BINARY_DIR}/test_output/PyStd)
+set(TEST_OUTPUT_DIR_STD ${CMAKE_BINARY_DIR}/test_output/Std)
 
 configure_file("${CONFIGURABLES_DIR}/auto_README.in" "${CMAKE_SOURCE_DIR}/auto/README" @ONLY)
 
diff --git a/cmake/configurables/BATesting.h.in b/cmake/configurables/BATesting.h.in
index ea9403d824dca01307b1c603b4ecdca56184cdc5..75f2a45ddb6523c05f3c54b31d830c5769e5fef2 100644
--- a/cmake/configurables/BATesting.h.in
+++ b/cmake/configurables/BATesting.h.in
@@ -43,15 +43,15 @@ inline std::string TestOutDir()
 }
 inline std::string TestOutDir_Std()
 {
-    return "@TEST_OUTPUT_DIR@/Std";
+    return "@TEST_OUTPUT_DIR_STD@";
 }
 inline std::string TestOutDir_Core()
 {
-    return "@TEST_OUTPUT_DIR@/Core";
+    return "@TEST_OUTPUT_DIR_CORE@";
 }
 inline std::string TestOutDir_PyStd()
 {
-    return "@TEST_OUTPUT_DIR@/PyStd";
+    return "@TEST_OUTPUT_DIR_PY_STD@";
 }
 
 } // namespace BATesting