diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e6109a3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +version: 2 +enable-beta-ecosystems: true +updates: + - package-ecosystem: "julia" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + groups: + actions: + patterns: + - "*" diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 335dbde..5672a7d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,10 +20,10 @@ jobs: matrix: include: - { os: ubuntu-latest, version: 'nightly', arch: x64} - - { os: ubuntu-latest, version: '1.13.0-rc1', arch: x64 } - - { os: ubuntu-latest, version: '1.13.0-rc1', arch: x86 } - - { os: windows-latest, version: '1.13.0-rc1', arch: x64} - - { os: macOS-latest, version: '1.13.0-rc1', arch: aarch64} + - { os: ubuntu-latest, version: '1.13', arch: x64 } + - { os: ubuntu-latest, version: '1.13', arch: x86 } + - { os: windows-latest, version: '1.13', arch: x64} + - { os: macOS-latest, version: '1.13', arch: aarch64} steps: - uses: actions/checkout@v4 diff --git a/Project.toml b/Project.toml index 1203427..da389a1 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ReTest" uuid = "e0db7c4e-2690-44b9-bad6-7687da720f89" -version = "0.4.0" +version = "0.4.1" authors = ["Rafael Fourquet "] [deps] diff --git a/src/testset.jl b/src/testset.jl index a0de8bd..6478e83 100644 --- a/src/testset.jl +++ b/src/testset.jl @@ -93,6 +93,9 @@ ReTestSet(desc::String; verbose::Bool=false) = # For a non-passed result, simply store the result record(ts::ReTestSet, t::Union{Broken,Fail,Error}) = (push!(ts.results, t); t) +# Convert a `LogTestFailure` to `Fail` like `Test.DefaultTestSet` +record(ts::ReTestSet, t::Test.LogTestFailure) = + (push!(ts.results, Fail(:test, t.orig_expr, t.logs, nothing, nothing, t.source, false)); t) # For a passed result, do not store the result since it uses a lot of memory record(ts::ReTestSet, t::Pass) = (ts.n_passed += 1; t) diff --git a/test/runtests.jl b/test/runtests.jl index 2f65ca7..6660fd0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1280,6 +1280,20 @@ end # Failing """) end +module FailingTestLogs +using ReTest +using Test: @test_logs + +@testset "logs fail" begin + # pattern expects "x", actual log is "y" → LogTestFailure + @test_logs (:info, "x") @info "y" +end +end # FailingTestLogs + +@chapter FailingTestLogs begin + @test_throws Test.TestSetException retest(FailingTestLogs) +end + module FailingLoops # we test that toplevel testset-for don't make retest unresponsive @@ -1806,8 +1820,18 @@ end replace(content, "load_path_function() = 1" => "load_path_function() = 2") end - Revise.revise() try + # Queue the tracked files explicitly, as Revise.revise() only processes changes + # that its file watcher task has already picked up, which is racy. + # Revise.revise(mod) can't be used since it looks up PkgId(mod), i.e. "Main". + @lock Revise.revise_lock for (id, pkgdata) in Revise.pkgdatas + if id.uuid === nothing && startswith(id.name, "Main.") + for file in pkgdata.info.files + push!(Revise.revision_queue, (pkgdata, file)) + end + end + end + Revise.revise() Test.@testset "revise works" begin retest(HijackTests2) @test Hijack.RUN == [2, 5, 4] @@ -1883,3 +1907,28 @@ end end @test Hijack.RUN == [1, 2, 3, 2, 3] end + +Test.@testset "record(::ReTestSet, ::LogTestFailure)" begin + ReTestSet = ReTest.Testset.ReTestSet + record = ReTest.Testset.record + anyfailed = ReTest.Testset.anyfailed + get_test_counts = ReTest.Testset.get_test_counts + + logfail = Test.LogTestFailure(:(@info "x"), LineNumberNode(1, :file), + Any[(:info, "x")], Any[]) + + # A failing `@test_logs` is recordable, and counts as a failure. + ts = ReTestSet(Main, "lt") + @test record(ts, logfail) === logfail + @test anyfailed(ts) + _, fails, errors, _ = get_test_counts(ts) + @test fails == 1 + @test errors == 0 + + # A testset with no failing result reports none. + ts2 = ReTestSet(Main, "lt_empty") + @test !anyfailed(ts2) + _, fails2, errors2, _ = get_test_counts(ts2) + @test fails2 == 0 + @test errors2 == 0 +end