CI tests the checkout's module, not the installed wheel
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 70/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- github-actions, python
- Domínio
- ci-cd, testing-qa
Direção de pesquisa
Comece pelo workflow de testes e por seus comandos atuais de instalação e pytest; em seguida, reproduza a verificação de importação a partir da raiz do repositório. Verifique se o workflow testa o wheel instalado, incluindo um wheel sem ipython_pygments_lexers.py; considera-se concluído quando o módulo ausente faz a execução dos testes falhar, em vez de passar usando a cópia do checkout.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
The tests workflow installs the project with python3 -m pip install "." pytest and then runs python3 -m pytest -v from the repository root. Because python -m puts the current directory first on sys.path, and the project is a single top-level module (ipython_pygments_lexers.py) next to its test file, the tests import ipython_pygments_lexers from the checkout rather than from the installed distribution. We observed this with an import probe in a clean container: in every run, the module was loaded from the working tree.
One consequence is that a packaging mistake in the wheel would not fail CI. To check, we built the wheel from the current main (50791e2) and made a copy of it with ipython_pygments_lexers.py removed. We then ran the tests from the repository root against each wheel (Python 3.12, pytest 9.1.1, pygments 2.21.0):
| Command | Intact wheel | Wheel without the module |
|---|---|---|
python -m pytest (the CI command) |
7 passed | 7 passed |
pytest |
7 passed | 7 passed |
pytest --import-mode=importlib |
7 passed | ImportError |
Switching to the pytest entry point alone is not enough. With the default import mode, pytest inserts the test file's directory (the repository root) into sys.path, which again puts the checkout's module first.
If the intention is to test the installed package, running pytest --import-mode=importlib in the workflow makes the tests import the installed copy. If testing the checkout is intended, and the install is only there for the Pygments entry points, please feel free to close this.
We are studying how Python test suites pick the copy of the code they test, and wanted to share the observation.
- Linguagem predominante
- Python
- Estrelas
- 0
- Forks
- 2
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de ipython/ipython-pygments-lexers
-
failure on shell commands after `%%time`Talvez já em andamento @ump45nose assumiu há 23 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
Todas as issues de ipython/ipython-pygments-lexers
Issues semelhantes
-
changelog investigate
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
ramnes/notion-sdk-py#409 ·
-
good first issue help wanted
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
lindicaphxag-tech/kaggle#28 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
BSData/horus-heresy-3rd-edition#3211 ·
Mantenedores costumam responder em até 1 dia
-
bug needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
bug tests
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia