Skip to content

Commit ca45ae9

Browse files
authored
Use MOI.Test.runtests (#20)
* Use MOI.Test.runtests * Stop checking out MOI * Revert "Stop checking out MOI" This reverts commit 1f7c5f1.
1 parent aa938ae commit ca45ae9

File tree

3 files changed

+3
-65
lines changed

3 files changed

+3
-65
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1414
FillArrays = "1.13.0"
1515
KrylovKit = "0.9.5"
1616
LinearAlgebra = "1.10"
17-
MathOptInterface = "1.34.0"
17+
MathOptInterface = "1.39.0"
1818
Test = "1.10"
1919
julia = "1.10"

src/Test/Test.jl

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -196,67 +196,4 @@ function MOI.Test.setup_test(
196196
return
197197
end
198198

199-
function runtests(
200-
model::MOI.ModelLike,
201-
config::MOI.Test.Config;
202-
include::Vector = String[],
203-
exclude::Vector = String[],
204-
warn_unsupported::Bool = false,
205-
verbose::Bool = false,
206-
exclude_tests_after::VersionNumber = v"999.0.0",
207-
)
208-
tests = filter(names(@__MODULE__; all = true)) do name
209-
return startswith("$name", "test_")
210-
end
211-
tests = string.(tests)
212-
for ex in exclude
213-
if ex in tests && any(t -> ex != t && occursin(ex, t), tests)
214-
@warn(
215-
"The exclude string \"$ex\" is ambiguous because it exactly " *
216-
"matches a test, but it also partially matches another. Use " *
217-
"`r\"^$ex\$\"` to exclude the exactly matching test, or " *
218-
"`r\"$ex.*\"` to exclude all partially matching tests.",
219-
)
220-
end
221-
end
222-
for name_sym in names(@__MODULE__; all = true)
223-
name = string(name_sym)
224-
if !startswith(name, "test_")
225-
continue # All test functions start with test_
226-
elseif !isempty(include) && !any(s -> occursin(s, name), include)
227-
continue
228-
elseif !isempty(exclude) && any(s -> occursin(s, name), exclude)
229-
continue
230-
end
231-
if verbose
232-
@info "Running $name"
233-
end
234-
test_function = getfield(@__MODULE__, name_sym)
235-
if MOI.Test.version_added(test_function) > exclude_tests_after
236-
if verbose
237-
println(" Skipping test because of `exclude_tests_after`")
238-
end
239-
continue
240-
end
241-
@testset "$(name)" begin
242-
c = copy(config)
243-
tear_down = MOI.Test.setup_test(test_function, model, c)
244-
# Make sure to empty the model before every test.
245-
MOI.empty!(model)
246-
try
247-
test_function(model, c)
248-
catch err
249-
if verbose
250-
println(" Test errored with $(typeof(err))")
251-
end
252-
MOI.Test._error_handler(err, name, warn_unsupported)
253-
end
254-
if tear_down !== nothing
255-
tear_down()
256-
end
257-
end
258-
end
259-
return
260-
end
261-
262199
end

test/Test/runtests.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ end
2323
function test_runtests()
2424
# Some tests are excluded because UniversalFallback accepts absolutely
2525
# everything.
26-
LRO.Test.runtests(
26+
MOI.Test.runtests(
2727
MOI.Utilities.MockOptimizer(
2828
MOI.Utilities.UniversalFallback(MOI.Utilities.Model{Float64}()),
2929
),
3030
MOI.Test.Config(),
3131
warn_unsupported = true,
3232
verbose = true,
33+
test_module = LRO.Test,
3334
)
3435
return
3536
end

0 commit comments

Comments
 (0)