From aa79a2e8d4358ef63309a4d9aa8695a934266a27 Mon Sep 17 00:00:00 2001 From: Louis Ponet Date: Mon, 21 Jun 2021 18:25:39 +0200 Subject: [PATCH] fixed versioning tests --- test/job_control_tests.jl | 22 +++++++++++----------- test/runtests.jl | 2 +- test/testassets/test_job/nscf.in | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/job_control_tests.jl b/test/job_control_tests.jl index b6d55342..a0127657 100644 --- a/test/job_control_tests.jl +++ b/test/job_control_tests.jl @@ -286,23 +286,23 @@ rm(joinpath(job, DFControl.VERSION_DIR_NAME), recursive=true) @testset "versioning" begin job[:nbnd] = 30 - job.version = 1 + curver = DFControl.last_version(job) + save(job) + @test job.version == curver+1 save(job) - @test job.version == 2 @test ispath(joinpath(job, DFControl.VERSION_DIR_NAME)) - @test ispath(joinpath(job, DFControl.VERSION_DIR_NAME, "1")) + @test ispath(joinpath(job, DFControl.VERSION_DIR_NAME, "$(curver+1)")) job[:nbnd] = 40 save(job) - @test job.version == 3 + @test job.version == curver + 3 @test job["scf"][:nbnd] == 40 - switch_version(job, 2) - @test job.version == 2 - @test !(2 ∈ versions(job)) - @test DFControl.last_version(job) == 3 + switch_version(job, curver+1) + @test job.version == curver+1 + # @test DFControl.last_version(job) == 2 @test job["scf"][:nbnd] == 30 - switch_version(job, 3) - @test !ispath(joinpath(job, DFControl.VERSION_DIR_NAME, "3")) - @test ispath(joinpath(job, DFControl.VERSION_DIR_NAME, "1")) + rm_version!(job, curver + 1) + @test !ispath(joinpath(job, DFControl.VERSION_DIR_NAME, "$(curver + 1)")) + @test ispath(joinpath(job, DFControl.VERSION_DIR_NAME, "$(curver + 2)")) end rm(joinpath(job, DFControl.VERSION_DIR_NAME), recursive=true) diff --git a/test/runtests.jl b/test/runtests.jl index d58caf5c..da09cfc8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,6 +6,6 @@ testdir = @__DIR__ @time @testset "documenation" begin @suppress include("documentation_tests.jl") end @time @testset "Setting defaults" begin @suppress include("defaults_tests.jl") end @time @testset "Job from CIF file" begin @suppress include("jobfromcif_tests.jl") end -@time @testset "Job control tests" begin @suppress include("job_control_tests.jl") end +@time @testset "Job control tests" begin include("job_control_tests.jl") end @time @testset "Remove defaults" begin @suppress include("rmdefaults_tests.jl") end end diff --git a/test/testassets/test_job/nscf.in b/test/testassets/test_job/nscf.in index 98c7826c..21790fa2 100644 --- a/test/testassets/test_job/nscf.in +++ b/test/testassets/test_job/nscf.in @@ -3,7 +3,7 @@ verbosity = 'high' calculation = 'nscf' outdir = 'localhost/test_job/outputs' - pseudo_dir = '/home/ponet/.julia/dev/DFControl/test/testassets/test_job' + pseudo_dir = '/home/lponet/.julia/dev/DFControl/test/testassets/test_job' restart_mode = 'from_scratch' /