python / python/cpython

``test_os.test_attributes()`` fails on Windows

未關閉
#126,253 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

OS-windows tests type-bug
主要語言
Python
星號
77.2k
分支
35.9k
PR 合併指標
PR 指標待擷取

描述

Bug report

Bug description:
./python -m test -v test_os
======================================================================
FAIL: test_attributes (test.test_os.TestScandir.test_attributes)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\eclips4\programming\cpython\Lib\test\test_os.py", line 5040, in test_attributes
    self.check_entry(entry, 'dir', True, False, False)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\eclips4\programming\cpython\Lib\test\test_os.py", line 5008, in check_entry
    self.assert_stat_equal(entry.stat(),
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
                           entry_stat,
                           ^^^^^^^^^^^
                           os.name == 'nt' and not is_symlink)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\eclips4\programming\cpython\Lib\test\test_os.py", line 4967, in assert_stat_equal
    self.assertEqual(getattr(stat1, attr),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
                     getattr(stat2, attr),
                     ^^^^^^^^^^^^^^^^^^^^^
                     (stat1, stat2, attr))
                     ^^^^^^^^^^^^^^^^^^^^^
AssertionError: 16 != 268435472 : (os.stat_result(st_mode=16895, st_ino=0, st_dev=0, st_nlink=0, st_uid=0, st_gid=0, st_size=0, st_atime=1730398311, st_mtime=1730398311, st_ctime=1730398311), os.stat_result(st_mode=16895, st_ino=5066549580979864, st_dev=2642700522657803134, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1730398311, st_mtime=1730398311, st_ctime=1730398311), 'st_file_attributes')

----------------------------------------------------------------------
Ran 367 tests in 16.254s

FAILED (failures=1, skipped=146)
test test_os failed
test_os failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
    test_os

Total duration: 21.1 sec
Total tests: run=367 failures=1 skipped=146
Total test files: run=1/1 failed=1
Result: FAILURE
CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs
  • gh-156305

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

在 Windows 上執行 ./python -m test -v test_os,並閱讀 Lib/test/test_os.py 中 test_attributes、check_entry 和 assert_stat_equal 附近的內容。將失敗與連結的 PR gh-156305 進行比較;完成標準是 test_os 在 Windows 上通過,且沒有報告的 st_file_attributes 不相符問題。

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

評估

技術堆疊
python
領域
operating-systems, testing-qa
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

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

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