From 1518216b74160d4a7aa8c2987816e663f162fd3d Mon Sep 17 00:00:00 2001 From: Olivier Labayle Date: Fri, 22 Dec 2023 17:22:02 +0100 Subject: [PATCH] close files before removing --- test/runner.jl | 11 ++++++----- test/sieve_variance.jl | 3 +++ test/summary.jl | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/test/runner.jl b/test/runner.jl index a8ce1f2..97e39b4 100644 --- a/test/runner.jl +++ b/test/runner.jl @@ -231,7 +231,7 @@ end @test results_from_hdf5[i][estimator].estimand isa TMLE.Estimand end end - + close(results_from_hdf5) # Clean rm(outputs.json.filename) rm(outputs.hdf5.filename) @@ -285,11 +285,12 @@ end @test length(results_from_json) == 3 # HDF5 - results_from_json = jldopen("output.hdf5") - @test length(results_from_json["Batch_1"]) == 2 - composed_result = only(results_from_json["Batch_2"]) + results_from_hdf5 = jldopen("output.hdf5") + @test length(results_from_hdf5["Batch_1"]) == 2 + composed_result = only(results_from_hdf5["Batch_2"]) @test composed_result.OSE.cov == results[3].OSE.cov - + close(results_from_hdf5) + rm(datafile) rm("output.jls") rm("output.json") diff --git a/test/sieve_variance.jl b/test/sieve_variance.jl index de1465c..8365d1b 100644 --- a/test/sieve_variance.jl +++ b/test/sieve_variance.jl @@ -313,6 +313,8 @@ end @test src_result.TMLE.n == svp_result.TMLE.n @test svp_result.TMLE.IC == [] end + close(tmleout1) + close(tmleout2) close(io) # clean rm("svp.hdf5") @@ -361,6 +363,7 @@ end @test standalone_estimates[i].OSE.std != src_results[i].OSE.std end + close(src_results) close(io) # clean diff --git a/test/summary.jl b/test/summary.jl index 92c454b..a75d0e1 100644 --- a/test/summary.jl +++ b/test/summary.jl @@ -70,6 +70,10 @@ include(joinpath(TESTDIR, "testutils.jl")) @test input.OSE.estimand == jls_output.OSE.estimand == hdf5_out.OSE.estimand == json_output[:OSE].estimand end + close(hdf5file_1) + close(hdf5file_2) + close(hdf5_output) + # cleanup rm("tmle_output_1.hdf5") rm("tmle_output_2.hdf5")