Difference in _use_fd_functions in shutil.py and test_shutil.py
未關閉
還沒有人認領這個 Issue。
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
When switching from os.listdir to os.scandir 7 years ago somebody forgot to update the definition of _use_fd_functions in test_shutil together with shutil module.
in shutil:
_use_fd_functions = ({os.open, os.stat, os.unlink, os.rmdir} <=
os.supports_dir_fd and
os.scandir in os.supports_fd and
os.stat in os.supports_follow_symlinks)
in test_shutil:
_use_fd_functions = ({os.open, os.stat, os.unlink, os.rmdir} <=
os.supports_dir_fd and
os.listdir in os.supports_fd and
os.stat in os.supports_follow_symlinks)
I believe there is no need to calculate this variable twice so I'm gonna propose a PR where I use the value from shutil.py in its tests. Nobody will ever forget to update both places again.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先比較 shutil.py 和 test_shutil.py 中的 _use_fd_functions 定義,接著檢查測試端的值如何被使用。執行 shutil 測試以確認目前的行為,並驗證測試使用模組的單一值,而不變更涵蓋率或平台特定行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- testing-qa
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100