Remove global random seed used for testing
@SripriyaDevarapalli 已经在做这个了。
开始于 2026年10月12日。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 重构
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- numpy, python
调研方向
Start by reading the pytest configuration changed in PR #1056 and locate tests that rely on random numbers in their scenarios. Review how those tests seed and use randomness, then identify which need independent generators passed explicitly. Done means the global seed is removed and affected tests retain reliable, independent random state.
由索引模型根据 Issue 内容生成。
描述
PR #1056 modified the pytest configuration to set a global random number seed, to deal with flaky tests that failed sporadically because some numerical comparisons exceeded tolerances undpredictably. Setting a global seed is not good practice. The seeds for test scenarios should be revised:
-
Avoid global seeds. It's generally better to avoid setting a global seed for all tests. Global seeds can cause unexpected behavior when different parts of the code rely on random numbers.
-
Use
numpy.random.default_rng. It's considered better to create aGeneratorinstance with a seed at the beginning of each test or test suite. This ensures that each test has its own independent random state. -
Pass
Generatorobjects. Pass theGeneratorobject around as an argument. This makes the random number generation explicit and avoids relying on global state.
- 主要语言
- Python
- 星标
- 1.7k
- 派生
- 438
- 平均合并
- 53 分钟
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quantumlib/OpenFermion 的其他 Issue
-
Switch to Pyrefly for type checking instead of mypy可能已有人在做 @rosspeili 于 122 天前认领。 未关闭a: health a: python e: experienced
quantumlib/OpenFermion#1399 · 6 条评论 · 已指派 1 人 ·
-
Add a CODEOWNERS file可能重新可做 @mhucka 于 148 天前认领,目前没有进行中的 PR。 未关闭a: devops e: maintainer
quantumlib/OpenFermion#1337 · 3 条评论 · 已指派 1 人 ·
-
Add workflow to run create-env-files.sh when Dependabot changes dependencies可能已有人在做 @rosspeili 于 130 天前认领。 未关闭a: devops e: experienced
quantumlib/OpenFermion#1332 · 4 条评论 · 已指派 1 人 ·
-
Are there any plans to support symbolic coefficients for QubitOperator?可能已有人在做 @anishbhujbal7 于 83 天前认领。 未关闭a: functionality s: awaiting-response
quantumlib/OpenFermion#1053 · 8 条评论 · 已指派 1 人 ·
-
Hubbard model notebook is flaky可能重新可做 @Vijay-112007 于 46 天前认领,目前没有进行中的 PR。 未关闭a: health a: tests e: experienced P2
quantumlib/OpenFermion#870 · 15 条评论 ·
查看 quantumlib/OpenFermion 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
OpenFreeEnergy/openfe#2371 ·
维护者通常 2 天内回复
-
HMDB's smiles file writes "None" for metabolites with an empty <smiles/> (file not currently used)未关闭
难度 2/5 1-3 小时 新手友好度 80/100
NCATSTranslator/Babel#1269 ·
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 80/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 64/100
bcgov/nr-hydrometric-rating-curve#443 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100