Skip to content

Commit ac051a1

Browse files
committed
Synchronize test with corresponding test in Brian
1 parent 424495b commit ac051a1

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

brian2cuda/tests/test_cuda_standalone.py

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,21 +326,39 @@ def test_delete_code_data():
326326
@pytest.mark.cuda_standalone
327327
@pytest.mark.standalone_only
328328
def test_delete_directory():
329-
set_device('cuda_standalone', build_on_run=True, directory=None)
330-
group = NeuronGroup(10, 'dv/dt = -v / (10*ms) : volt', method='exact')
331-
group.v = np.arange(10)*mV # uses the static array mechanism
329+
set_device("cuda_standalone", build_on_run=True, directory=None)
330+
group = NeuronGroup(10, "dv/dt = -v / (10*ms) : volt", method="exact")
331+
group.v = np.arange(10) * mV # uses the static array mechanism
332332
run(defaultclock.dt)
333333
# Add a new file
334-
dummy_file = os.path.join(device.project_dir, 'results', 'dummy.txt')
335-
open(dummy_file, 'w').flush()
334+
dummy_file = os.path.join(device.project_dir, "results", "dummy.txt")
335+
open(dummy_file, "w").flush()
336336
assert os.path.isfile(dummy_file)
337337
with catch_logs() as logs:
338338
device.delete(directory=True)
339-
assert len(logs) == 1
339+
assert (
340+
len(
341+
[
342+
l
343+
for l in logs
344+
if l[1] == "brian2.devices.cpp_standalone.device.delete_skips_directory"
345+
]
346+
)
347+
== 1
348+
)
340349
assert os.path.isfile(dummy_file)
341350
with catch_logs() as logs:
342351
device.delete(directory=True, force=True)
343-
assert len(logs) == 0
352+
assert (
353+
len(
354+
[
355+
l
356+
for l in logs
357+
if l[1] == "brian2.devices.cpp_standalone.device.delete_skips_directory"
358+
]
359+
)
360+
== 0
361+
)
344362
# everything should be deleted
345363
assert not os.path.exists(device.project_dir)
346364

0 commit comments

Comments
 (0)