Skip to content

Commit

Permalink
Allow setting the logs argument via the environment (#111)
Browse files Browse the repository at this point in the history
* Allow setting the `logs` argument via the environment

With `RETESTITEMS_LOGS` set to the appropriate string ("batched",
"eager" or "issues").

* Bump version

* Update Project.toml

---------

Co-authored-by: Nick Robinson <[email protected]>
  • Loading branch information
kpamnany and nickrobinson251 committed Oct 4, 2023
1 parent ea52cd5 commit fb8ddef
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 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.18.0"
version = "1.19.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
2 changes: 1 addition & 1 deletion src/ReTestItems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function runtests(
name::Union{Regex,AbstractString,Nothing}=nothing,
tags::Union{Symbol,AbstractVector{Symbol},Nothing}=nothing,
report::Bool=parse(Bool, get(ENV, "RETESTITEMS_REPORT", "false")),
logs::Symbol=default_log_display_mode(report, nworkers),
logs::Symbol=Symbol(get(ENV, "RETESTITEMS_LOGS", default_log_display_mode(report, nworkers))),
verbose_results::Bool=(logs !== :issues && isinteractive()),
test_end_expr::Expr=Expr(:block),
)
Expand Down
2 changes: 1 addition & 1 deletion test/_test_log_capture.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file defines tests that are run (under various configurations) by `test/log_capture.jl`.
using ReTestItems, Test, Logging, IOCapture
const log_display = Symbol(ENV["LOG_DISPLAY"])
const log_display = Symbol(ENV["RETESTITEMS_LOGS"])

@testset "log capture logs=$(repr(log_display))" begin
@testset "TestItem" begin
Expand Down
2 changes: 1 addition & 1 deletion test/log_capture.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using Test

@testset "$log_display" for log_display in (:eager, :batched, :issues)
# Need to run in a separate process to force --color=yes in CI.
cmd = addenv(`$(Base.julia_cmd()) --project=$PROJECT_PATH --color=yes $LOG_CAPTURE_TESTS_PATH`, "LOG_DISPLAY" => log_display)
cmd = addenv(`$(Base.julia_cmd()) --project=$PROJECT_PATH --color=yes $LOG_CAPTURE_TESTS_PATH`, "RETESTITEMS_LOGS" => log_display)
p = run(pipeline(ignorestatus(cmd); stdout, stderr), wait=false)
wait(p)
@test success(p)
Expand Down

2 comments on commit fb8ddef

@nickrobinson251
Copy link
Collaborator

Choose a reason for hiding this comment

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

@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/92727

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.19.0 -m "<description of version>" fb8ddefc6479e0b9c9c208a73ce8b1f95e62f39b
git push origin v1.19.0

Please sign in to comment.