Skip to content

Commit b381807

Browse files
Fix logging test counting bug when more workers than tests (#219)
* Fix test counting bug when more workers than tests * Bump version
1 parent 65de2c4 commit b381807

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ReTestItems"
22
uuid = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
3-
version = "1.33.0"
3+
version = "1.33.1"
44

55
[deps]
66
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

src/testcontext.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ function get_starting_testitems(ti::TestItems, n)
163163
# mark eval_number
164164
t.eval_number[] = i
165165
end
166-
@atomic ti.count += n
166+
@atomic ti.count += length(testitems)
167167
return [testitems; fill(nothing, n - length(testitems))]
168168
end
169169

test/integrationtests.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,4 +1496,17 @@ end
14961496
@test_throws exc runtests(joinpath(TEST_FILES_DIR, "_happy_tests.jl"); tags=[:blahahahaha_nope])
14971497
end
14981498

1499+
@testset "bugfix: don't overcount when nworkers > ntestitems" begin
1500+
using IOCapture
1501+
nworkers = 4
1502+
c = IOCapture.capture() do
1503+
encased_testset(() -> runtests(joinpath(TEST_FILES_DIR, "_happy_tests.jl"); nworkers))
1504+
end
1505+
results = c.value
1506+
@assert nworkers > n_tests(results)
1507+
@assert n_tests(results) == 3
1508+
# the bug was printing `4/3`
1509+
@test contains(c.output, "3/3 test items were run.")
1510+
end
1511+
14991512
end # integrationtests.jl testset

0 commit comments

Comments
 (0)