@@ -196,67 +196,4 @@ function MOI.Test.setup_test(
196
196
return
197
197
end
198
198
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
-
262
199
end
0 commit comments