[issue19921] Path.mkdir(0, True) always fails

Vajrasky Kok report at bugs.python.org
Sun Dec 8 09:39:48 CET 2013


Vajrasky Kok added the comment:

Fails on Windows Vista.

...................................................s..s..s..s.......F.
......
======================================================================
FAIL: test_mkdir_parents (__main__.PathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib\test\test_pathlib.py", line 1502, in test_mkdir_parents
    self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o555 & mode)
AssertionError: 511 != 365

======================================================================
FAIL: test_mkdir_parents (__main__.WindowsPathTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib\test\test_pathlib.py", line 1502, in test_mkdir_parents
    self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o555 & mode)
AssertionError: 511 != 365

----------------------------------------------------------------------
Ran 326 tests in 3.293s

FAILED (failures=2, skipped=90)

This line is problematic.
self.assertEqual(stat.S_IMODE(p.stat().st_mode), 0o555 & mode)

>From http://docs.python.org/2/library/os.html#os.chmod:

Note
Although Windows supports chmod(), you can only set the file’s read-only flag with it (via the stat.S_IWRITE and stat.S_IREAD constants or a corresponding integer value). All other bits are ignored.

In Django, we skip chmod test on Windows.
https://github.com/django/django/blob/master/tests/staticfiles_tests/tests.py#L830

But this line is okay:
self.assertEqual(stat.S_IMODE(p.parent.stat().st_mode), mode)

So we should just skip that particular problematic line on Windows.

----------
nosy: +vajrasky

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19921>
_______________________________________


More information about the Python-bugs-list mailing list