[New-bugs-announce] [issue40648] File mode is not tested on Windows

Pavol Babinčák report at bugs.python.org
Sat May 16 11:47:26 EDT 2020


New submission from Pavol Babinčák <scroolik at gmail.com>:

>From what I can tell only place where file mode is tested is test_mode() method of class TestFilemode in test_stat.py. Relevant section for Windows (os.name != 'posix'):

with open(TESTFN, 'w'):
  pass

...

os.chmod(TESTFN, 0o700)
st_mode, modestr = self.get_mode()
self.assertEqual(modestr[:3], '-rw')
self.assertS_IS("REG", st_mode)
self.assertEqual(self.statmod.S_IFMT(st_mode),
                 self.statmod.S_IFREG)

Doesn't test that files under Windows can have only two modes:
- 0o444 - If os.chmod() is missing stat.S_IWRITE. Effectively readonly.
- 0o666 - Regular file by default.

On the top of that I believe last two assertions are equivalent - test file is regular. But that would be for a different issue, I guess.

----------
components: Tests
messages: 369056
nosy: scrool
priority: normal
severity: normal
status: open
title: File mode is not tested on Windows
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40648>
_______________________________________


More information about the New-bugs-announce mailing list