| 1213 | self.assertEqual(mtime, os.path.getmtime(self._path)) |
| 1214 | |
| 1215 | def test_add_and_close(self): |
| 1216 | # Verifying that closing a mailbox doesn't change added items |
| 1217 | self._box.add(_sample_message) |
| 1218 | for i in range(3): |
| 1219 | self._box.add(self._template % i) |
| 1220 | self._box.add(_sample_message) |
| 1221 | self._box._file.flush() |
| 1222 | self._box._file.seek(0) |
| 1223 | contents = self._box._file.read() |
| 1224 | self._box.close() |
| 1225 | with open(self._path, 'rb') as f: |
| 1226 | self.assertEqual(contents, f.read()) |
| 1227 | self._box = self._factory(self._path) |
| 1228 | |
| 1229 | @warnings_helper.ignore_fork_in_thread_deprecation_warnings() |
| 1230 | @support.requires_fork() |