pytest.ini wins even when it's empty, and `.pytest.ini` is never read

Aberta Para iniciantes
#159 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
84/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
python, typescript

Direção de pesquisa

Comece lendo readPytestSettings e PROJECT_FILES e, em seguida, encontre os testes com fixtures sintéticos descritos em CONTRIBUTING.md. Adicione uma fixture em que um pytest.ini vazio tenha prioridade sobre pyproject.toml e outra em que .pytest.ini configure python_files; execute npm test. O trabalho estará concluído quando os dois casos passarem e .pytest.ini sozinho for detectado como um projeto Python.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

adapter bug good first issue

pytest's rule: pytest.ini "will always match and take precedence … even if empty", and it matches even without a [pytest] section. The hidden .pytest.ini works the same way. Only pyproject.toml, tox.ini and setup.cfg need their section to match. The first match wins, and options are never merged.

readPytestSettings skips any file without the section (if (!section) continue;) and never looks at .pytest.ini. So:

  • With a pytest.ini that has only a comment, plus a pyproject.toml that sets python_files = ["check_*.py"], DiffCI uses check_*.py. pytest uses its defaults, test_*.py and *_test.py. DiffCI then doesn't see test_x.py as a test.
  • With only a .pytest.ini that sets python_files = check_*.py, DiffCI uses the defaults and doesn't see check_x.py as a test.

Done when:

  • The search order is pytest.ini, .pytest.ini, then pyproject.toml, tox.ini and setup.cfg.
  • An existing pytest.ini or .pytest.ini stops the search, even without a [pytest] section. pytest's defaults apply when it has no section.
  • .pytest.ini is added to PROJECT_FILES, so a repository whose only pytest file is .pytest.ini is detected as a Python project.
  • There is a test for each of the two cases above.

New to DiffCI? See CONTRIBUTING.md: add a synthetic fixture, run npm test, and sign off commits with git commit -s. Comment here to claim the issue.

Linguagem predominante
TypeScript
Estrelas
0
Forks
4
Merge médio
18h 41min
PRs com merge (30d)
48

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de DiffCI/core

Todas as issues de DiffCI/core

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.