test.test_zoneinfo.test_zoneinfo.ExtensionBuiltTest.test_cache_location fails if `_zoneinfo` Cextension isn't built
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
Bug report
Bug description:
I was doing some testing to check that Python without optional C extensions remains functional, and I've noticed that the following test fails if _zoneinfo is not built:
======================================================================
FAIL: test_cache_location (test.test_zoneinfo.test_zoneinfo.ExtensionBuiltTest.test_cache_location)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/mgorny/git/cpython/Lib/test/test_zoneinfo/test_zoneinfo.py", line 1931, in test_cache_location
self.assertFalse(hasattr(c_zoneinfo.ZoneInfo, "_weak_cache"))
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: True is not false
FWICS the zoneinfo module tests unconditionally assume that zoneinfoimported with no "blocked" modules. While most of the time, this shouldn't matter, I suppose it would be cleaner to haveget_modules()returnNoneasc_moduleif_zoneinfo` is not importable.
I can try making a PR for this if you agree with this approach (and skipping the duplicate-then C extension tests).
CC @pganssle
CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-131104
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 em Lib/test/test_zoneinfo/test_zoneinfo.py, em ExtensionBuiltTest.test_cache_location, e inspecione get_modules(), especialmente como ele lida com um módulo _zoneinfo indisponível. Verifique os testes de zoneinfo quando a extensão C opcional não estiver compilada, incluindo se os testes duplicados da extensão C são ignorados. Considera-se concluído quando a suíte de testes não presumir mais que _zoneinfo pode ser importado e a falha relatada estiver resolvida.
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
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 38/100