Initialization bug with helpers over `test`
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
No source file or test is named; start by reproducing the FooBaseSuite/FooSpec example with Scala 3.3.1, weaver 0.8.3, and cats-effect 3.5.1. Trace IOSuite initialization and resource lifetime around helper-registered tests, then verify that Foo remains usable and add a regression test for the trait/object case.
Written by the indexing model from the issue text.
Description
This issue was copied over from: https://github.com/disneystreaming/weaver-test/issues/705
It was opened by: BalmungSan
I found a strange issue with weaver around initialization... or at least that is what I think.
It is a bit involved but hopefully, I can provide enough info for someone to take a look.
// First, we need a base Suite with a bunch of helpers:
trait FooBaseSuite extends IOSuite:
override final val maxParallelism: Int = 1
override final type Res = FooRes
override final val sharedResource: Resource[IO, Res] = ???
// Define helper method to reduce boilerplate:
protected def fooTest(name: String)(check: Foo => Expectations): Unit =
test(name) { foo =>
IO(check(foo))
}
// Then we need an object that extends such base Suite:
object FooSpec extends FooBaseSuite:
// And use the helper method:
fooTest(name = "Testing foo") { foo =>
expect(...)
}
The tests will fail because Foo is already closed (or so I think).
There are a couple of ways to fix the issue:
- Don't have a
trait+objectbut just a singleobject - Remove the
fooTesthelper and replicate the boilerplate in eachtest - Make
FooSpecaclasswhich accepts an (unused)GlobalRead
Things that didn't work:
- Using
abstract classrather thantrait - Moving
fooTestfrom thetrait(FooBaseSuite) to theobject(FooSpec)
More info:
- Scala
3.3.1 - weaver:
0.8.3 - cats-effect:
3.5.1 - sbt:
1.9.6 - Java: GraalVM CE
17.0.8 - OS: Mac
14.0
- Dominant language
- Scala
- Stars
- 85
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from typelevel/weaver-test
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
typelevel/weaver-test#302 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
typelevel/weaver-test#262 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
typelevel/weaver-test#233 · 3 comments · 2 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
typelevel/weaver-test#201 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
typelevel/weaver-test#180 ·
All issues in typelevel/weaver-test
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ergoplatform/ergodocs#614 ·
-
area:ci enhancement requires-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/datafusion-comet#6078 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
[VL] madvise(WILLNEED) call fails in MmapFileStream because of wrong calculation of fetching length Openbug triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
chipsalliance/rocket-chip#3831 ·