Make Memory-Related Tests Less Fragile
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece revisando os testes sensíveis à memória mencionados no issue: test_gdb.test_pretty_print, test_capi, test_exceptions, test_regrtest, test_repl, test_sys e test_tracemalloc. Identifique quais asserções de alocação ou de falta de memória dependem de contagens fixas e, em seguida, determine como as verificações de comportamento podem continuar precisas sem esses números exatos. O trabalho estará concluído quando os testes afetados tolerarem mudanças relevantes no gerenciamento de memória e ainda detectarem regressões.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- testing-qa
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 25/100