Initialization bug with helpers over `test`
还没有人认领这个 Issue。
评估
调研方向
没有指定源文件或测试;首先使用 Scala 3.3.1、weaver 0.8.3 和 cats-effect 3.5.1 重现 FooBaseSuite/FooSpec 示例。跟踪 helper 注册的测试周围的 IOSuite 初始化和资源生命周期,然后验证 Foo 仍可使用,并为 trait/object 情况添加回归测试。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Scala
- 星标
- 87
- 派生
- 15
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
typelevel/weaver-test 的其他 Issue
-
难度 5/5 一周以上 新手友好度 15/100
typelevel/weaver-test#372 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 65/100
typelevel/weaver-test#302 · 3 条评论 ·
-
Remove or filter weaver log levels可能重新可做 @Sukuna0007Abhi 于 268 天前认领,目前没有进行中的 PR。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
typelevel/weaver-test#262 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 35/100
typelevel/weaver-test#233 · 3 条评论 · 2 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 52/100
typelevel/weaver-test#201 ·
查看 typelevel/weaver-test 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 78/100
scalameta/metals-zed#99 ·
-
Bound wrong-magic P2P diagnostics to parsed header bytes可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
ergoplatform/ergo#2736 ·
维护者通常 1 天内回复
-
perf: use extend when buffering partition row indices in the native shuffle writer可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area:shuffle enhancement good first issue performance requires-triage
难度 2/5 1-3 小时 新手友好度 78/100
apache/datafusion-comet#7072 ·
维护者通常 1 天内回复
-
bug 🐞 CI/CD ⚒️
难度 2/5 1-3 小时 新手友好度 78/100
valkey-io/valkey-glide#7370 ·
维护者通常 1 天内回复
-
Improve UI text on confirmation page (at registration)可能已有人在做 @Arghyann 于 1 天前认领。 未关闭good first issue improvement
难度 1/5 1 小时以内 新手友好度 72/100
lichess-org/lila#22126 · 2 条评论 ·
维护者通常 1 天内回复