feat: run doctests as a part of the test suit - #776
Open
thepabloaguilar wants to merge 12 commits into
Open
Conversation
thepabloaguilar
force-pushed
the
issue-765
branch
from
August 29, 2026 06:34
e6e1eb3 to
a53fa9c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #776 +/- ##
==========================================
+ Coverage 99.09% 99.47% +0.38%
==========================================
Files 26 26
Lines 775 765 -10
Branches 0 98 +98
==========================================
- Hits 768 761 -7
+ Misses 7 2 -5
- Partials 0 2 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Author
|
Aparentemente deu uma quedinha de ~0.67% na cobertura dos testes porquê não estava sendo considerado o branching (que vira o partial), vou escrever os testes restantes para aumentar a cobertura novamente e mantendo o branching |
thepabloaguilar
force-pushed
the
issue-765
branch
from
August 29, 2026 14:33
12cb9f7 to
e1d94cc
Compare
# Conflicts: # poetry.lock
thepabloaguilar
force-pushed
the
issue-765
branch
from
September 7, 2026 04:30
55e7ff5 to
198097b
Compare
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.
Descrição
A issue original fala sobre alguns exemplos da documentação que estão errados, isso afeta diretamente a experiência do usuário da biblioteca.
Mudanças Propostas
Para resolver esse problema e tentar evitar esses errors futuramente minha proposta é utilizarmos o pytest apenas como o runner dos testes, ou seja, os testes continuarão a serem escritos utilizando o módulo unittest mas sendo executados com o pytest.
O pytest facilita bastante a nossa vida com o descobrimento automático dos doctests não só em arquivos Python mas também em arquivos Markdown, para termos o mesmo efeito com o unittest teríamos que fazer algo mais manual o que talvez aumentaria um pouco o risco de existir exemplos errados novamente. E além dessa facilidade ele também tem ótimos plugins que podemos utilizar e tomei a liberdade de colocar dois:
Com a introdução do
pytesteu rodei todos os testes e fui arrumando cada um que não estava adequado e coloquei o comentário# doctest: +SKIPpara previnir que funções que tenham efeitos colaterias (exemplo: fazer um request) rodem como parte do suite de testes.Como tinha que modificar o workflow de testes para rodar o pytest ao invés do unittest fiz alguns ajustes:
3.14do Python na matriz de testeChecklist de Revisão
Declaração de Uso de IA (OBRIGATÓRIA)
Comentários Adicionais (opcional)
Nos arquivos Markdown eu troquei os blocos
pythonpor blocospycon(pyconsole) que é o recomendado nesse caso que estamos "simulando" o REPL e tem um highlight diferente:Issue Relacionada
Closes #765