Skip to content

Commit dd0a987

Browse files
authored
Fix tests on Julia nightly (#863)
* Fix tests on Julia nightly The tests for specific exception types in `sem` are relying on the exceptions thrown from deeper in the call stack, outside of this package's control. We do still expect these cases to throw, but since we can't actually control the type of the exception, we can instead test that any exception is thrown. The test of the number of allocations from calling `mad` on a generator fails because there are nearly 10x more allocations than the upper bound used in the test. We can mark this test broken with Julia v1.10, and the test will fail if the allocations for this case are improved, be it upstream or in the implementation of `mad` (if applicable). * Bump Documenter version to fix doc build Simply going from Documenter 0.24 to the latest, 0.27, fixes `makedocs` for me locally. This should fix the documentation build on CI.
1 parent 06ab08c commit dd0a987

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
44
StatsAPI = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
55

66
[compat]
7-
Documenter = "0.24"
7+
Documenter = "0.27"

test/scalarstats.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ x = sort!(vcat([5:-1:i for i in 1:5]...))
201201
@test @inferred(isnan(sem(Int[], ProbabilityWeights(Int[]); mean=0f0)))
202202

203203
@test @inferred(isnan(sem(skipmissing(Union{Int,Missing}[missing, missing]))))
204-
@test_throws MethodError sem(Any[])
205-
@test_throws MethodError sem(skipmissing([missing]))
204+
@test_throws Exception sem(Any[])
205+
@test_throws Exception sem(skipmissing([missing]))
206206

207207
@test mad(1:5; center=3, normalize=true) 1.4826022185056018
208208
@test mad(skipmissing([missing; 1:5; missing]); center=3, normalize=true) 1.4826022185056018
@@ -221,7 +221,14 @@ x = sort!(vcat([5:-1:i for i in 1:5]...))
221221
@test_throws ArgumentError mad(Int[], normalize = true)
222222
@test mad(Iterators.repeated(4, 10)) == 0
223223
@test mad(Integer[1,2,3,4]) === mad(1:4)
224-
@test (@benchmark mad((i for i in 1:10000))).allocs < 200
224+
let itr = (i for i in 1:10000)
225+
if VERSION >= v"1.10.0-"
226+
# FIXME: Allocations are closer to 10x this on 1.10
227+
@test_broken (@benchmark mad($itr)).allocs < 200
228+
else
229+
@test (@benchmark mad($itr)).allocs < 200
230+
end
231+
end
225232

226233
# Issue 197
227234
@test mad(1:2, normalize=true) 0.7413011092528009

0 commit comments

Comments
 (0)