Skip to content

Commit

Permalink
Wrap _runtests_in_current_env in current logger to avoid world age …
Browse files Browse the repository at this point in the history
…issues (#46)

* Wrap `_runtests_in_current_env` in current logger

* Bump patch version
  • Loading branch information
nickrobinson251 authored May 2, 2023
1 parent 22eeee4 commit 23ef7fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ReTestItems"
uuid = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
version = "1.3.0"
version = "1.3.1"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
22 changes: 13 additions & 9 deletions src/ReTestItems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,19 @@ function _runtests(shouldrun, paths, nworkers::Int, nworker_threads::Int, worker
proj_file = identify_project(dir)
proj_file == "" && error("Could not find project directory for `$(dir)`")
@debugv 1 "Running tests in `$paths` for project at `$proj_file`"
if is_running_test_runtests_jl(proj_file)
# Assume this is `Pkg.test`, so test env already active.
@debugv 2 "Running in current environment `$(Base.active_project())`"
return _runtests_in_current_env(shouldrun, paths, proj_file, nworkers, nworker_threads, worker_init_expr, testitem_timeout, retries, verbose_results, debug, report, logs)
else
@debugv 1 "Activating test environment for `$proj_file`"
return Pkg.activate(proj_file) do
TestEnv.activate() do
_runtests_in_current_env(shouldrun, paths, proj_file, nworkers, nworker_threads, worker_init_expr, testitem_timeout, retries, verbose_results, debug, report, logs)
# Wrapping with the logger that was set before eval'ing any user code to
# avoid world age issues when logging https://github.com/JuliaLang/julia/issues/33865
with_logger(current_logger()) do
if is_running_test_runtests_jl(proj_file)
# Assume this is `Pkg.test`, so test env already active.
@debugv 2 "Running in current environment `$(Base.active_project())`"
return _runtests_in_current_env(shouldrun, paths, proj_file, nworkers, nworker_threads, worker_init_expr, testitem_timeout, retries, verbose_results, debug, report, logs)
else
@debugv 1 "Activating test environment for `$proj_file`"
return Pkg.activate(proj_file) do
TestEnv.activate() do
_runtests_in_current_env(shouldrun, paths, proj_file, nworkers, nworker_threads, worker_init_expr, testitem_timeout, retries, verbose_results, debug, report, logs)
end
end
end
end
Expand Down

2 comments on commit 23ef7fc

@NHDaly
Copy link
Member

@NHDaly NHDaly commented on 23ef7fc May 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/82726

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.3.1 -m "<description of version>" 23ef7fc0c43e070940e91cc8b95d3d046c5a11d8
git push origin v1.3.1

Please sign in to comment.