Skip to content

Broken on 1.3 as DefaultTestSet fields are now const #136

Closed

Description

@iamed2
ERROR: setfield!: const field .time_start of type DefaultTestSet cannot be changed
Stacktrace:
  [1] setproperty!(x::Test.DefaultTestSet, f::Symbol, v::Int64)
    @ Base ./Base_compiler.jl:61
  [2] set_time_taken!(ts::Test.DefaultTestSet, time_taken::Millisecond)
    @ TestReports ~/.julia/packages/TestReports/Xd6qM/src/testsets.jl:213
  [3] add_to_ts_default!(ts_default::Test.DefaultTestSet, ts::ReportingTestSet)
    @ TestReports ~/.julia/packages/TestReports/Xd6qM/src/testsets.jl:409
  [4] _broadcast_getindex_evalf
    @ ./broadcast.jl:704 [inlined]
  [5] _broadcast_getindex
    @ ./broadcast.jl:677 [inlined]
  [6] _getindex
    @ ./broadcast.jl:621 [inlined]
  [7] getindex
    @ ./broadcast.jl:617 [inlined]
  [8] copy
    @ ./broadcast.jl:938 [inlined]
  [9] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(TestReports.add_to_ts_default!), Tuple{Base.RefValue{Test.DefaultTestSet}, Vector{Any}}})
    @ Base.Broadcast ./broadcast.jl:899
 [10] display_reporting_testset(ts::ReportingTestSet)
    @ TestReports ~/.julia/packages/TestReports/Xd6qM/src/testsets.jl:369
 [11] finish(ts::ReportingTestSet)
    @ TestReports ~/.julia/packages/TestReports/Xd6qM/src/testsets.jl:109
 [12] top-level scope
    @ none:14
 [13] macro expansion
    @ /opt/hostedtoolcache/julia/1.13.0/x64/share/julia/stdlib/v1.13/Test/src/Test.jl:1978 [inlined]
 [14] eval(m::Module, e::Any)
    @ Core ./boot.jl:489
 [15] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:310
 [16] _start()
    @ Base ./client.jl:577
ERROR: LoadError: TestReports failed to generate the report.

Change in Julia occurred in JuliaLang/julia@364ecb3

Probably either the approach to combining test sets needs to change or sets of this field need to copy the whole testset. Both of these seem unfortunate but the latter perhaps more so.

Activity

  1. ararslan commented on Sep 10, 2026

    @ararslan

    Looks like we only attempt to overwrite the timing information on Julia 1.8+, falling back to leaving it as-is:

    set_time_taken!(ts::AbstractTestSet, time_taken::Millisecond) = nothing
    VERSION >= v"1.8" && function set_time_taken!(ts::DefaultTestSet, time_taken::Millisecond)
    ts.time_start = 0
    ts.time_end = time_taken.value / 1000
    return ts
    end

    Perhaps it would suffice to amend the version check to v"1.8" <= VERSION < v"1.13.0-DEV.1037" so that 1.13 would be unbroken and other versions would be unaffected.

  2. oxinabox commented on Sep 11, 2026

    @oxinabox
    Member

    Its been a long time since i wrote/reviewed that code.
    It is clearly not a crucial feature since it was disabled pre-1.8
    I suspect without it the report might end up missing timing data for the top level testset

  3. kleinschmidt commented on Sep 15, 2026

    @kleinschmidt
    Contributor

    AFAICT the only place where this code actually is used is in displaying the test set ... which is called in finish(::ReportingTestSet). Whats more it seems like the code is not actually in any meaningful way relying on the modify-in-place behavior. IIUC it's basically creating new DefaultTestSets for display purposes, so doing an Accessors.@set shouldn't be the worst thing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions