Infraestrutura de testes.#80
Merged
Merged
Conversation
Os testes partilham `config.settings.test`: PostgreSQL (via `DATABASE_URL` do Compose), Celery em modo eager, sem debug toolbar.
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.
O que esse PR faz?
Corrige e unifica a infraestrutura de testes do markapi, que estava incompleta (sem
config.settings.test, dependências de pytest incompletas, CI a ignorar falhas com|| true).Entregas principais:
config/settings/test.py— settings partilhadas pormanage.py testepytest(PostgreSQL via Compose, Celery eager, cache em memória, sem debug toolbar,LLAMA_ENABLED=False).pytest.ini+ dependências emrequirements/local.txt(pytest-django,pytest-cov,coverage,django-coverage-plugin).users/tests.py(valida queCustomUserestá configurado).tests; remove|| true; executamanage.py testepytestcom--rm.django_test/django_fastusam--settings=config.settings.test; novos alvospytest,pytest_fast,pytest_cov.setup.cfg— paths de cobertura alinhados às apps do projeto.docs/testing.mde secção Testing doREADME.md.Este PR não adiciona testes de negócio das apps editoriais; o objetivo é pipeline reproduzível (Docker + CI) que falha de verdade em regressões de configuração.
Onde a revisão poderia começar?
config/settings/test.pypytest.inierequirements/local.txt.github/workflows/ci.ymlMakefile(alvos de teste)users/tests.pyComo este poderia ser testado manualmente?
Na raiz do repositório:
make build(obrigatório após mudança emrequirements/local.txt).make up(oudocker compose -f local.yml up -d postgres redis).make django_migratemake django_test— esperado:Ran 1 test/OK.make pytest— esperado:1 passed.make pytest_cov— relatório de cobertura no terminal.(Opcional) Simular CI:
docker compose -f local.yml build docker compose -f local.yml run --rm django python manage.py migrate docker compose -f local.yml run --rm django python manage.py test --settings=config.settings.test docker compose -f local.yml run --rm django pytest docker compose -f local.yml downGuia completo:
docs/testing.md.Algum cenário de contexto que queira dar?
config.settings.testno mypy, README compytest/coverage) sem ficheiros nem deps correspondentes.manage.py test, mas a CI corria sópytestcom|| true, logo o pipeline nunca falhava.django.contrib.postgrese do stack Wagtail.markup_doc,xml_managerereferencepara testes futuros.Screenshots
N/A
Quais são tickets relevantes?
N/A
Referências
docs/testing.md