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-
191" Exit code for runner when tests fail"
202const TESTS_FAILED = 3
213
@@ -170,7 +152,7 @@ function gen_command(runner_code, julia_args, coverage)
170152end
171153
172154"""
173- isinstalled!(ctx::Union{ Context, EnvCache}, pkgspec::Types.PackageSpec)
155+ isinstalled!(ctx::Context, pkgspec::Pkg. Types.PackageSpec)
174156
175157Checks if the package is installed by using `ensure_resolved` from `Pkg/src/Types.jl`.
176158This 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
180162is of type `Pkg.Types.Context`. For earlier versions, they are of type
181163`Pkg.Types.EnvCache`.
182164"""
183- function isinstalled!(ctx:: Context , pkgspec:: Types.PackageSpec )
165+ function isinstalled!(ctx:: Context , pkgspec:: Pkg. Types.PackageSpec )
184166 @static if VERSION >= v" 1.4.0"
185167 var = ctx
186168 else
@@ -198,12 +180,12 @@ function isinstalled!(ctx::Context, pkgspec::Types.PackageSpec)
198180end
199181
200182"""
201- gettestfilepath(ctx::Context, pkgspec::Types.PackageSpec)
183+ gettestfilepath(ctx::Context, pkgspec::Pkg. Types.PackageSpec)
202184
203185Gets the testfile path of the package. Code for each Julia version mirrors that found
204186in `Pkg/src/Operations.jl`.
205187"""
206- function gettestfilepath(ctx:: Context , pkgspec:: Types.PackageSpec )
188+ function gettestfilepath(ctx:: Context , pkgspec:: Pkg. Types.PackageSpec )
207189 @static if VERSION >= v" 1.4.0"
208190 if is_project_uuid(ctx, pkgspec. uuid)
209191 pkgspec. path = dirname(ctx. env. project_file)
@@ -235,7 +217,7 @@ function gettestfilepath(ctx::Context, pkgspec::Types.PackageSpec)
235217 elseif entry. path != = nothing
236218 pkgfilepath = project_rel_path(ctx, entry. path)
237219 elseif pkgspec. uuid in keys(ctx. stdlibs)
238- pkgfilepath = Types. stdlib_path(pkgspec. name)
220+ pkgfilepath = Pkg . Types. stdlib_path(pkgspec. name)
239221 else
240222 throw(PkgTestError(" Could not find either `git-tree-sha1` or `path` for package $(pkgspec. name) " ))
241223 end
@@ -252,7 +234,7 @@ function gettestfilepath(ctx::Context, pkgspec::Types.PackageSpec)
252234 elseif haskey(info, " path" )
253235 pkgfilepath = project_rel_path(ctx, info[" path" ])
254236 elseif pkgspec. uuid in keys(ctx. stdlibs)
255- pkgfilepath = Types. stdlib_path(pkgspec. name)
237+ pkgfilepath = Pkg . Types. stdlib_path(pkgspec. name)
256238 else
257239 throw(PkgTestError(" Could not find either `git-tree-sha1` or `path` for package $(pkgspec. name) " ))
258240 end
0 commit comments