MCPcopy Index your code
hub / github.com/python/cpython / test_permissions_after_flush

Method test_permissions_after_flush

Lib/test/test_mailbox.py:1073–1088  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1071 self.assertEqual(len(self._box), 1)
1072
1073 def test_permissions_after_flush(self):
1074 # See issue #5346
1075
1076 # Make the mailbox world writable. It's unlikely that the new
1077 # mailbox file would have these permissions after flush(),
1078 # because umask usually prevents it.
1079 mode = os.stat(self._path).st_mode | 0o666
1080 os.chmod(self._path, mode)
1081
1082 self._box.add(self._template % 0)
1083 i = self._box.add(self._template % 1)
1084 # Need to remove one message to make flush() create a new file
1085 self._box.remove(i)
1086 self._box.flush()
1087
1088 self.assertEqual(os.stat(self._path).st_mode, mode)
1089
1090 @requires_root_user
1091 @unittest.skipUnless(hasattr(os, 'chown'), 'requires os.chown')

Callers

nothing calls this directly

Calls 6

statMethod · 0.45
chmodMethod · 0.45
addMethod · 0.45
removeMethod · 0.45
flushMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected