CI tests the checkout's module, not the installed wheel
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 70/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- github-actions, python
- 領域
- ci-cd, testing-qa
調査の方向性
tests workflow と現在の install および pytest コマンドから始め、その後、リポジトリのルートから import probe を再現します。workflow がインストールされた wheel をテストしていることを、ipython_pygments_lexers.py を含まない wheel も含めて確認します。完了の条件は、欠落しているモジュールによってテスト実行が失敗し、checkout のコピーに対して実行して成功することがないことです。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 0
- フォーク
- 2
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ipython/ipython-pygments-lexers のほかの issue
-
failure on shell commands after `%%time`対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
ipython/ipython-pygments-lexers の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Juniper/ansible-junos-stdlib#904 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
pollen-robotics/reachy_mini#1457 ·
メンテナーはふだん 1 日以内に返信
-
area:runtime good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
WATonomous/wato_f1tenth#39 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
FireDynamics/fdsreader#123 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100