beacon-biosignals / Legolas.jl

Tables.jl-friendly mechanisms for constructing, reading, writing, and validating Arrow tables against extensible, versioned, user-specified schemas.
Other
24 stars 2 forks source link

Tests are not re-runnable in same session #93

Open ericphanson opened 1 year ago

ericphanson commented 1 year ago

My usual workflow is something like:

using TestEnv
TestEnv.activate()
include("test/runtests.jl")
# Change code in tests/package using Revise
include("test/runtests.jl")

However for Legolas that breaks in a few places:

https://github.com/beacon-biosignals/Legolas.jl/blob/b86444ccc2b9f0cffa4f6fe8f8f724339fcc7ea4/test/runtests.jl#L5

This test depends on what has already been defined in Main, which seems like a bad practice unto itself. That can be fixed by wrapping it in a module.

https://github.com/beacon-biosignals/Legolas.jl/blob/b86444ccc2b9f0cffa4f6fe8f8f724339fcc7ea4/test/runtests.jl#L552-L558

This definition when called a second time says that it is an invalid redefinition. I suppose this too could be wrapped in a module (which gets replaced when the tests are re-included, so there is no struct redefinition).