Repository navigation
Usa dados de teste únicos e avisa quando a limpeza falha - #36
Merged
Merged
Conversation
Cada booking criado ganha um sufixo aleatório no sobrenome, para que a busca por nome encontre só o booking do próprio teste na API pública compartilhada. Falhas de rede ou de autenticação na limpeza passam a gerar um aviso do pytest com o id do booking, em vez de serem ignoradas em silêncio.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Resumo
default_booking()gera o sobrenome com um sufixo aleatório (Ciclano-3f9a1c). A API pública é compartilhada, inclusive pelas duas versões do Python que o CI roda em paralelo. Com o sufixo, o TC-006 (busca por nome) encontra só o booking do próprio testecontextpassa a capturar sórequests.RequestExceptioneValidationError(falha de rede ou de autenticação ao gerar o token de limpeza) e emite umwarnings.warncom o id do booking que ficou para trás. Antes, qualquer exceção era ignorada em silêncioexceptcobria o caso de o cenário já ter removido o booking. Nesse caso, porém, a API só devolve um status de erro, sem exceção, então o comentário foi corrigidoTest plan
mypy .ruff check .ruff format --check .pytest: 53/53 testes passandoAPI_PASSWORD=errada pytest -m TC-004: o teste passa, e o resumo mostraUserWarning: booking <id> não foi removido na limpeza. O booking deixado por essa verificação foi removido manualmente em seguida