1
- using Pkg
2
- import Pkg: PackageSpec, Types
3
- import Pkg. Types: Context, EnvCache, ensure_resolved, is_project_uuid
4
- import Pkg. Operations: project_resolve!, project_deps_resolve!, manifest_resolve!, manifest_info, project_rel_path
5
-
6
- # Version specific imports
7
- @static if VERSION >= v " 1.4.0"
8
- import Pkg. Operations: gen_target_project
9
- else
10
- import Pkg. Operations: with_dependencies_loadable_at_toplevel
11
- end
12
- @static if VERSION >= v " 1.2.0"
13
- import Pkg. Operations: update_package_test!, source_path, sandbox
14
- else
15
- import Pkg. Operations: find_installed
16
- import Pkg. Types: SHA1
17
- end
18
-
19
1
" Exit code for runner when tests fail"
20
2
const TESTS_FAILED = 3
21
3
@@ -170,7 +152,7 @@ function gen_command(runner_code, julia_args, coverage)
170
152
end
171
153
172
154
"""
173
- isinstalled!(ctx::Union{ Context, EnvCache}, pkgspec::Types.PackageSpec)
155
+ isinstalled!(ctx::Context, pkgspec::Pkg. Types.PackageSpec)
174
156
175
157
Checks if the package is installed by using `ensure_resolved` from `Pkg/src/Types.jl`.
176
158
This function fails if the package is not installed, but here we wrap it in a
@@ -180,7 +162,7 @@ For Julia versions V1.4 and later, the first arguments of the Pkg functions used
180
162
is of type `Pkg.Types.Context`. For earlier versions, they are of type
181
163
`Pkg.Types.EnvCache`.
182
164
"""
183
- function isinstalled! (ctx:: Context , pkgspec:: Types.PackageSpec )
165
+ function isinstalled! (ctx:: Context , pkgspec:: Pkg. Types.PackageSpec )
184
166
@static if VERSION >= v " 1.4.0"
185
167
var = ctx
186
168
else
@@ -198,12 +180,12 @@ function isinstalled!(ctx::Context, pkgspec::Types.PackageSpec)
198
180
end
199
181
200
182
"""
201
- gettestfilepath(ctx::Context, pkgspec::Types.PackageSpec)
183
+ gettestfilepath(ctx::Context, pkgspec::Pkg. Types.PackageSpec)
202
184
203
185
Gets the testfile path of the package. Code for each Julia version mirrors that found
204
186
in `Pkg/src/Operations.jl`.
205
187
"""
206
- function gettestfilepath (ctx:: Context , pkgspec:: Types.PackageSpec )
188
+ function gettestfilepath (ctx:: Context , pkgspec:: Pkg. Types.PackageSpec )
207
189
@static if VERSION >= v " 1.4.0"
208
190
if is_project_uuid (ctx, pkgspec. uuid)
209
191
pkgspec. path = dirname (ctx. env. project_file)
@@ -235,7 +217,7 @@ function gettestfilepath(ctx::Context, pkgspec::Types.PackageSpec)
235
217
elseif entry. path != = nothing
236
218
pkgfilepath = project_rel_path (ctx, entry. path)
237
219
elseif pkgspec. uuid in keys (ctx. stdlibs)
238
- pkgfilepath = Types. stdlib_path (pkgspec. name)
220
+ pkgfilepath = Pkg . Types. stdlib_path (pkgspec. name)
239
221
else
240
222
throw (PkgTestError (" Could not find either `git-tree-sha1` or `path` for package $(pkgspec. name) " ))
241
223
end
@@ -252,7 +234,7 @@ function gettestfilepath(ctx::Context, pkgspec::Types.PackageSpec)
252
234
elseif haskey (info, " path" )
253
235
pkgfilepath = project_rel_path (ctx, info[" path" ])
254
236
elseif pkgspec. uuid in keys (ctx. stdlibs)
255
- pkgfilepath = Types. stdlib_path (pkgspec. name)
237
+ pkgfilepath = Pkg . Types. stdlib_path (pkgspec. name)
256
238
else
257
239
throw (PkgTestError (" Could not find either `git-tree-sha1` or `path` for package $(pkgspec. name) " ))
258
240
end
0 commit comments