Skip to content

Commit af39f5d

Browse files
authored
Fix empty strings as extra files for ExternalModel (#258)
1 parent 51db0c4 commit af39f5d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/models/external/externalmodel.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ function makedirectory(m::ExternalModel, sample, path::String)
6868
end
6969

7070
for file in m.extras
71+
if isempty(file)
72+
continue
73+
end
7174
cp(joinpath(m.sourcedir, file), joinpath(path, file))
7275
end
7376
return nothing

test/models/external/externalmodel.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ include("../../test_utilities/read_write_utils.jl")
6868
result = UncertaintyQuantification.getresult(ext, dirname)
6969

7070
@test isapprox(result[1], sqrt.(df.x[1] .^ 2 + df.y[1] .^ 2))
71+
72+
ext = ExternalModel(
73+
sourcedir,
74+
sourcefile,
75+
radius,
76+
solver;
77+
workdir=tempname(),
78+
formats=numberformats,
79+
extras="",
80+
)
81+
UncertaintyQuantification.makedirectory(ext, df[1, :], dirname)
82+
@test isdir(dirname)
83+
@test isfile(joinpath(dirname, "radius.jl"))
84+
@test !isnotanywhere(joinpath(dirname, "radius.jl"), formatted_inputs[1])
85+
@test !isnotanywhere(joinpath(dirname, "radius.jl"), formatted_inputs[2])
7186
end
7287

7388
@testset "No Cleanup" begin

0 commit comments

Comments
 (0)