Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #812 +/- ##
==========================================
+ Coverage 98.82% 99.08% +0.26%
==========================================
Files 26 26
Lines 767 767
==========================================
+ Hits 758 760 +2
+ Misses 9 7 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #811
Descrição
Os testes
test_get_municipality_by_code_gzip_erroretest_get_municipality_by_code_gzip_generic_errormockavam apenasgzip.GzipFile.read, sem mockar ourlopen— então faziam uma requisição HTTP real à API do IBGE a cada execução.Como o
urlopendo Python não enviaAccept-Encoding: gzipe a API do IBGE passou a respeitar esse header (respondendo sem compressão quando ele não é enviado), o caminho do gzip em_fetch_ibge_datanunca era executado: o mock doGzipFile.readnão era acionado, o JSON real era processado e o teste recebia('São Paulo', 'SP')em vez deNone. Isso vinha derrubando o workflowrun-testsde todos os PRs recentes (#805, #808, #810 e o PR do dependabotruff-0.17.6, que não altera código do projeto).Solução
Adicionado o mock do
urlopennos dois testes, entregando uma resposta marcada comoContent-Encoding: gzippor meio do helper_create_mock_response(dados, "gzip")que o próprio arquivo já usa nos testes vizinhos, e mantendo o patch doGzipFile.readque simula a falha de descompressão. Os testes agora exercitam o caminho de erro do gzip de forma determinística, sem acesso à rede.Nenhuma linha de código de produção foi alterada — o bug era exclusivamente dos testes.
Com esta mudança, a suíte completa volta a ficar verde: 176 testes, 0 falhas.
Checklist
Declaração de Uso de IA (OBRIGATÓRIA)
Ferramenta utilizada: Claude Code (Anthropic). A ferramenta foi usada para investigar a causa raiz e escrever a correção dos testes, sob minha direção e revisão. Todo o conteúdo foi revisado e aprovado por mim antes do envio.
Comentários Adicionais
test_get_municipality_by_code_json_decode_error,test_get_code_by_municipality_name_not_found,test_empty_string_parameters). Passam hoje, mas estão sujeitos ao mesmo risco — posso tratá-los num follow-up para manter este PR focado em desbloquear o CI.