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