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 摘要。