`test_warnings` not restoring filters for free threading tests
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug description:
PYTHONWARNINGS=default ./python.exe -W default -m test test_warnings
Using random seed: 2934466897
0:00:00 load avg: 8.99 mem: 287.4 MiB Run 1 test sequentially in a single process
0:00:00 load avg: 8.99 mem: 287.4 MiB [1/1] test_warnings
Warning -- warnings.filters was modified by test_warnings
Warning -- Before: (12918522352, [('default', None, <class 'Warning'>, None, 0)], [('default', None, <class 'Warning'>, None, 0)])
Warning -- After: (12918522352, [('default', None, <class 'Warning'>, None, 0)], [])
0:00:20 load avg: 7.32 mem: 392.4 MiB [1/1/1] test_warnings failed (env changed)
This appears to race because the setUp is calling resetwarnings without getting it's own context.
This does not appear on the Cpython CI since --py-debug is used I believe which starts the warnings filter by default as an empty list so less likely to race, this occurred to me when running cpython tests against a release build and this test would not work.
The root cause I think is due to regr test asserting that the env hasn't been changed, however due to starting the test with warnings that are cleared this does not hold true
CPython versions tested on:
CPython main branch
Operating systems tested on:
Macos
Linked PRs
- gh-155609
Guida per i contributori
Apri 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.
Direzione di ricerca
Inizia eseguendo PYTHONWARNINGS=default ./python.exe -W default -m test test_warnings ed esamina la configurazione di test_warnings intorno a resetwarnings. Verifica come il test di regressione confronta l’ambiente degli avvisi prima e dopo; il lavoro è completato quando il test ripristina i propri filtri e il comando non segnala più una modifica dell’ambiente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- testing-qa
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100