MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_add_doesnt_rewrite

Method test_add_doesnt_rewrite

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

Source from the content-addressed store, hash-verified

1045 '''Common tests for single-file mailboxes'''
1046
1047 def test_add_doesnt_rewrite(self):
1048 # When only adding messages, flush() should not rewrite the
1049 # mailbox file. See issue #9559.
1050
1051 # Inode number changes if the contents are written to another
1052 # file which is then renamed over the original file. So we
1053 # must check that the inode number doesn't change.
1054 inode_before = os.stat(self._path).st_ino
1055
1056 self._box.add(self._template % 0)
1057 self._box.flush()
1058
1059 inode_after = os.stat(self._path).st_ino
1060 self.assertEqual(inode_before, inode_after)
1061
1062 # Make sure the message was really added
1063 self._box.close()
1064 self._box = self._factory(self._path)
1065 self.assertEqual(len(self._box), 1)
1066
1067 def test_permissions_after_flush(self):
1068 # See issue #5346

Callers

nothing calls this directly

Calls 7

lenFunction · 0.85
_factoryMethod · 0.80
statMethod · 0.45
addMethod · 0.45
flushMethod · 0.45
assertEqualMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected