From 8ed24f0b0d03c09ba8167e8ad43a774773b3bcd5 Mon Sep 17 00:00:00 2001 From: Jae Hoon Seo Date: Thu, 3 Dec 2026 18:21:04 +0900 Subject: [PATCH] test: run the Python suite in a working folder of its own python_package ran pytest in the build folder. An in-memory deck (DeckFile.from_text) takes its side files from the working directory, and wavekin_modes writes wave_frequencies.txt there. Under ctest -j the two overlap: in a Release run on the Prescott kernel the parity test test_standalone_mixed_deck_runs_on_the_aggregate_in_its_current read a half-written file and got "wave_frequencies.txt needs at least two `omega Re Im` rows" instead of the refusal it checks (the Haswell run of the same build passed). A one-row wave_frequencies.txt in the build folder reproduces it with the old working folder. python_package now runs in build/python_package_cwd, which no test writes into; the suite passes there with that file in the build folder. Signed-off-by: Jae Hoon Seo --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 998a1eca..d412d39b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2347,8 +2347,14 @@ if(Python3_Interpreter_FOUND) OUTPUT_QUIET ERROR_QUIET) endif() if(_pybind_deps_rc EQUAL 0) + # The suite runs in a folder of its own: an in-memory deck (DeckFile.from_text) takes its side + # files (wave_frequencies.txt, current_profile.txt, ...) from the working directory, and tests + # such as wavekin_modes write theirs into the build folder while this one runs under ctest -j. + set(_cabledyn_python_test_cwd "${CMAKE_BINARY_DIR}/python_package_cwd") + file(MAKE_DIRECTORY "${_cabledyn_python_test_cwd}") add_test(NAME python_package - COMMAND ${Python3_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/python/tests -q) + COMMAND ${Python3_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/python/tests -q + WORKING_DIRECTORY "${_cabledyn_python_test_cwd}") if(WIN32 AND CABLEDYN_RUNTIME_DLLS) # Python 3.8+ deliberately ignores PATH for dependent-DLL resolution. # Exercise the self-contained deployment set whose shared library and GNU/OpenBLAS