@@ -8,12 +8,17 @@ const OTHER_TEST_LEVEL = 3
8
8
9
9
# # IMPORTANT
10
10
11
- # There are two main ways to flag a problem model for integration test purposes.
11
+ # There are three main ways to flag a problem model for integration test purposes.
12
12
13
13
# - Adding to `FILTER_GIVEN_ISSUE` means the model is allowed to fail silently, unless
14
14
# tests pass, a fact that will be reported in the log.
15
15
16
- # - Adding to `PATHOLOGIES` completely excludes the model from testing.
16
+ # - Adding to `PATHOLOGIES` excludes the model from testing (although there will still be
17
+ # an attempt to load the model type, unless the package providing it is excluded from
18
+ # the MLJ/Project.toml)
19
+
20
+ # - Completetely exclude all models provided by a particular package from testing, by
21
+ # excluding the package from the [extras] section of MLJ/Project.toml.
17
22
18
23
# Obviously the first method is strongly preferred.
19
24
@@ -52,9 +57,34 @@ FILTER_GIVEN_ISSUE = Dict(
52
57
)
53
58
54
59
60
+ # # SEE IF PROJECT FILE INCLUDES ALL MODEL-PROVIDING PACKAGES
61
+
62
+ # helper; `project_lines` are lines from a Project.toml file:
63
+ function pkgs (project_lines)
64
+ project = TOML. parse (join (project_lines, " \n " ))
65
+ headings = Set (keys (project)) ∩ [" deps" , " extras" ]
66
+ return vcat (collect .(keys .([project[h] for h in headings]))... )
67
+ end
68
+
69
+ # identify missing pkgs:
70
+ project_path = joinpath (@__DIR__ , " .." , " Project.toml" )
71
+ project_lines = open (project_path) do io
72
+ readlines (io)
73
+ end
74
+ pkgs_in_project = pkgs (project_lines)
75
+ registry_project_lines = MLJModels. Registry. registry_project ()
76
+ pkgs_in_registry = pkgs (registry_project_lines)
77
+ missing_pkgs = setdiff (pkgs_in_registry, pkgs_in_project)
78
+ # If there are missing packages a warning is issued at the end
79
+
80
+
55
81
# # LOG OUTSTANDING ISSUES TO STDOUT
56
82
57
- const MODELS = models ();
83
+ const MODELS = filter (models ()) do m
84
+ pkg = m. package_name
85
+ api_pkg = split (m. load_path, ' .' ) |> first
86
+ api_pkg in pkgs_in_project
87
+ end
58
88
const JULIA_MODELS = filter (m-> m. is_pure_julia, MODELS);
59
89
const OTHER_MODELS = setdiff (MODELS, JULIA_MODELS);
60
90
158
188
WITHOUT_DATASETS = vcat (WITHOUT_DATASETS, PATHOLOGIES)
159
189
160
190
161
- # # CHECK PROJECT FILE INCLUDES ALL MODEL-PROVIDING PACKAGES
162
-
163
- # helper; `project_lines` are lines from a Project.toml file:
164
- function pkgs (project_lines)
165
- project = TOML. parse (join (project_lines, " \n " ))
166
- headings = Set (keys (project)) ∩ [" deps" , " extras" ]
167
- return vcat (collect .(keys .([project[h] for h in headings]))... )
168
- end
169
-
170
- # identify missing pkgs:
171
- project_path = joinpath (@__DIR__ , " .." , " Project.toml" )
172
- project_lines = open (project_path) do io
173
- readlines (io)
174
- end
175
- pkgs_in_project = pkgs (project_lines)
176
- registry_project_lines = MLJModels. Registry. registry_project ()
177
- pkgs_in_registry = pkgs (registry_project_lines)
178
- missing_pkgs = setdiff (pkgs_in_registry, pkgs_in_project)
179
-
180
- # throw error if there are any:
181
- isempty (missing_pkgs) || error (
182
- " Integration tests cannot proceed because the following packages are " *
183
- " missing from the [extras] section of the MLJ Project.toml file: " *
184
- join (missing_pkgs, " , " )
185
- )
186
-
187
191
# # LOAD ALL MODEL CODE
188
192
189
193
# Load all the model providing packages with a broad level=1 test:
@@ -236,10 +240,14 @@ for (model_set, level) in [
236
240
end
237
241
end
238
242
243
+ isempty (missing_pkgs) || @warn " Integration tests for the following packages in the " *
244
+ " model registry were omitted, as they do not have an entry in the [extras] " *
245
+ " section of the MLJ Project.toml file: " * join (missing_pkgs, " , " )
239
246
okay = isempty (problems)
240
- okay || print (" Integration tests failed for these models: \n $problems " )
241
- println ()
247
+ okay || @error " Integration tests failed for these models: \n $problems "
242
248
249
+ println ()
250
+ # throw error if there are any issues:
243
251
@test okay
244
252
245
253
true
0 commit comments