classification
Title: Test file mode on Windows
Type: enhancement Stage: patch review
Components: Tests, Windows Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: paul.moore, scrool, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2020-05-16 15:47 by scrool, last changed 2020-05-23 04:11 by terry.reedy.

Pull Requests
URL Status Linked Edit
PR 20130 open scrool, 2020-05-16 15:56
Messages (1)
msg369056 - (view) Author: Pavol Babinčák (scrool) * Date: 2020-05-16 15:47
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.
History
Date User Action Args
2020-05-23 04:11:36terry.reedysettitle: File mode is not tested on Windows -> Test file mode on Windows
2020-05-23 04:11:14terry.reedysetnosy: + paul.moore, tim.golden, zach.ware, steve.dower

components: + Windows
versions: + Python 3.10, - Python 3.9
2020-05-16 15:56:33scroolsetkeywords: + patch
stage: patch review
pull_requests: + pull_request19435
2020-05-16 15:47:26scroolcreate