CI tests the checkout's module, not the installed wheel
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 70/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- github-actions, python
- 領域
- ci-cd, testing-qa
研究方向
先從 tests workflow 及其目前的 install 和 pytest 指令開始,然後從 repository 根目錄重現 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 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
ipython/ipython-pygments-lexers 的其他 Issue
-
failure on shell commands after `%%time`可能已有人在做 @ump45nose 於 23 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 68/100
查看 ipython/ipython-pygments-lexers 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 83/100
維護者通常 1 天內回覆
-
enhancement
難度 2/5 1-3 小時 新手友好度 82/100
fabriziosalmi/certmate#1207 ·
維護者通常 1 天內回覆
-
[work-item] adam-adae-onset-emergence: document the minute-precision datetime coercion (ASTTMF not derivable)可能已有人在做 @muse-yamaa-bot 今天認領。 未關閉work-item
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
CommunityToolkit/Aspire#2231 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
volcengine/OpenViking#5711 ·
維護者通常 1 天內回覆