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

未關閉 適合新手
#159 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
84/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python, typescript

研究方向

先閱讀 readPytestSettings 和 PROJECT_FILES,接著尋找 CONTRIBUTING.md 中描述的合成 fixture 測試。新增一個 fixture,用來驗證空的 pytest.ini 優先於 pyproject.toml;再新增一個 fixture,用來驗證 .pytest.ini 設定 python_files;執行 npm test。兩個案例都通過,且僅憑 .pytest.ini 就能偵測為 Python 專案時,即告完成。

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
TypeScript
星號
0
分支
4
平均合併
18 小時 41 分鐘
30 天內合併 PR
48

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

DiffCI/core 的其他 Issue

查看 DiffCI/core 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。