Resolução Desafio Desenvolvendo sua Primeira API com FastAPI, Python e Docker#25
Open
Luiz0tavi0 wants to merge 15 commits intodigitalinnovationone:mainfrom
Open
Resolução Desafio Desenvolvendo sua Primeira API com FastAPI, Python e Docker#25Luiz0tavi0 wants to merge 15 commits intodigitalinnovationone:mainfrom
Luiz0tavi0 wants to merge 15 commits intodigitalinnovationone:mainfrom
Conversation
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.
Workout API - Fork com Melhorias
Este fork do repositório original
digitalinnovationone/workout_apitraz atualizações e melhorias com foco em qualidade de código, ferramentas modernas e testes robustos.🔧 Atualização de Dependências
FastAPIatualizado para^0.116.1SQLAlchemyv2 com suporte aasynciopsycopg2porpsycopg[binary](versão 3)pydantic-settingsv2⚙️ Gerenciamento com Poetry
pyproject.toml🧪 Testes Modernos
pytest-asynciopytest-covtestcontainersfactory-boy@pytest.mark.parametrize🐳 Testes com TestContainers
🧪 Testes Automatizados com Banco Real (TestContainers + SQLAlchemy Async)
Este projeto utiliza um setup moderno e robusto para testes, com as seguintes características:
SQLAlchemy Asyncehttpx.AsyncClient.factory_boypara gerar dados consistentes nos testes.Exemplo de como o banco é iniciado e utilizado nos testes:
Além disso, o
clientde testes substitui a dependência original deget_sessionpara injeção direta daAsyncSession, mantendo os testes isolados e controlados.Isso garante testes confiáveis, rápidos e que simulam o ambiente real da aplicação.
testcontainerspara subir containers reais do PostgreSQL durante os testes.Exemplo de uso:
🧹 Lint e Format com Ruff
ruffmigrations/excluídos do lint🛠️ Automatização com Taskipy
Scripts prontos para facilitar o desenvolvimento:
Hooks automatizados:
pre_test: roda o lint antes dos testespost_test: gera relatório HTML de cobertura após os testes📁 Estrutura Moderna e Organizada
models/,schemas/,repositories/,routers/,exceptions/tests/com cobertura robusta e testes assíncronospytest.inicom:asyncio_mode = strictpythonpath = "."testpaths = ["tests"]