From 6350406c14b003d0f30299879f99db316d4d5034 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Fri, 14 Nov 2025 15:49:38 +0000 Subject: [PATCH 1/2] Add C++ standalone test with clean=True --- brian2/tests/test_cpp_standalone.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/brian2/tests/test_cpp_standalone.py b/brian2/tests/test_cpp_standalone.py index 30d86209a..06caba86b 100644 --- a/brian2/tests/test_cpp_standalone.py +++ b/brian2/tests/test_cpp_standalone.py @@ -424,6 +424,21 @@ def test_run_with_debug(): run(defaultclock.dt) +@pytest.mark.cpp_standalone +@pytest.mark.standalone_only +def test_run_with_clean(): + # We just want to make sure that it works for now (there was a bug on Windows where + # using clean=True deleted sourcefiles.txt) + set_device( + "cpp_standalone", build_on_run=True, debug=True, clean=True, directory=None + ) + group = NeuronGroup(1, "v: 1", threshold="False") + syn = Synapses(group, group, on_pre="v += 1") + syn.connect() + mon = SpikeMonitor(group) + run(defaultclock.dt) + + @pytest.mark.cpp_standalone @pytest.mark.standalone_only def test_run_with_synapses_and_profile(): From 0bb5f4a592d1a28ada05064df6166a0b01909572 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Fri, 14 Nov 2025 17:01:11 +0000 Subject: [PATCH 2/2] Do not delete sourcefiles.txt with make clean This file is needed for making main.exe --- brian2/devices/cpp_standalone/templates/win_makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/brian2/devices/cpp_standalone/templates/win_makefile b/brian2/devices/cpp_standalone/templates/win_makefile index 33e13299e..7f08ed4c3 100644 --- a/brian2/devices/cpp_standalone/templates/win_makefile +++ b/brian2/devices/cpp_standalone/templates/win_makefile @@ -3,7 +3,6 @@ all: main.exe clean: del *.obj /s del *.exe /s - del sourcefiles.txt {% for fname, base in zip(source_files, source_bases) | sort(attribute='0')%} {{base}}.obj: win_makefile