Remove global random seed used for testing
@SripriyaDevarapalli ci sta già lavorando.
Dal 12/10/2026.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- numpy, python
- Ambito
- machine-learning, testing
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 1.7k
- Fork
- 438
- Merge medio
- 53m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di quantumlib/OpenFermion
-
Switch to Pyrefly for type checking instead of mypyForse già presa @rosspeili l’ha presa 122 giorni fa. Apertaa: health a: python e: experienced
quantumlib/OpenFermion#1399 · 6 commenti · 1 assegnatario ·
-
Add a CODEOWNERS fileForse di nuovo libera @mhucka l’ha presa 148 giorni fa e non c’è nessuna pull request aperta. Apertaa: devops e: maintainer
quantumlib/OpenFermion#1337 · 3 commenti · 1 assegnatario ·
-
Add workflow to run create-env-files.sh when Dependabot changes dependenciesForse già presa @rosspeili l’ha presa 130 giorni fa. Apertaa: devops e: experienced
quantumlib/OpenFermion#1332 · 4 commenti · 1 assegnatario ·
-
Are there any plans to support symbolic coefficients for QubitOperator?Forse già presa @anishbhujbal7 l’ha presa 83 giorni fa. Apertaa: functionality s: awaiting-response
quantumlib/OpenFermion#1053 · 8 commenti · 1 assegnatario ·
-
Hubbard model notebook is flakyForse di nuovo libera @Vijay-112007 l’ha presa 46 giorni fa e non c’è nessuna pull request aperta. Apertaa: health a: tests e: experienced P2
quantumlib/OpenFermion#870 · 15 commenti ·
Tutte le issue di quantumlib/OpenFermion
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
OpenFreeEnergy/openfe#2371 ·
I maintainer di solito rispondono entro 2 giorni
-
HMDB's smiles file writes "None" for metabolites with an empty <smiles/> (file not currently used)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
NCATSTranslator/Babel#1269 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno
-
404 on sample dataApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
bcgov/nr-hydrometric-rating-curve#443 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100