Make Memory-Related Tests Less Fragile
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Feature or enhancement
Proposal:
There are a number of tests that check various aspects of memory management, typically related to some specific module or feature. Nearly every one of these tests is fairly tightly coupled to the fine details of our memory management implementation, usually tied to specific numbers.
This makes the tests fragile, often breaking with even slight changes to some aspect of memory management. [^1]
[^1]: To be fair, we don't make changes to memory management very often; clearly these tests aren't breaking all the time.
For example, in https://github.com/python/cpython/pull/121134#issuecomment-2233412265, @Fidget-Spinner says:
It fails
test.test_gdb.test_pretty_print test_capi test_exceptions test_regrtest test_repl test_sys test_tracemallocmainly because they count allocations/test out of memory situations, and the hashtable adds random allocations which breaks their careful calculations.
[^2]
[^2]: Note that those aren't necessarily the only tests that need attention here.
Ideally, we would find a way to make such tests less coupled to specific numbers, without sacrificing the accuracy of the behavior checks they are making.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der Durchsicht der im Issue genannten speichersensitiven Tests: test_gdb.test_pretty_print, test_capi, test_exceptions, test_regrtest, test_repl, test_sys und test_tracemalloc. Ermitteln Sie, welche Assertions zu Allokationen oder Speicherknappheit von festen Zählwerten abhängen, und bestimmen Sie anschließend, wie ihre Verhaltensprüfungen ohne diese exakten Zahlen korrekt bleiben können. Die Aufgabe ist abgeschlossen, wenn die betroffenen Tests relevante Änderungen an der Speicherverwaltung tolerieren und weiterhin Regressionen erkennen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- testing-qa
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100