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

Method test_clean

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

Source from the content-addressed store, hash-verified

749 self.assertEqual(self._box.list_folders(), [])
750
751 def test_clean(self):
752 # Remove old files from 'tmp'
753 foo_path = os.path.join(self._path, 'tmp', 'foo')
754 bar_path = os.path.join(self._path, 'tmp', 'bar')
755 with open(foo_path, 'w', encoding='utf-8') as f:
756 f.write("@")
757 with open(bar_path, 'w', encoding='utf-8') as f:
758 f.write("@")
759 self._box.clean()
760 self.assertTrue(os.path.exists(foo_path))
761 self.assertTrue(os.path.exists(bar_path))
762 foo_stat = os.stat(foo_path)
763 os.utime(foo_path, (time.time() - 129600 - 2,
764 foo_stat.st_mtime))
765 self._box.clean()
766 self.assertFalse(os.path.exists(foo_path))
767 self.assertTrue(os.path.exists(bar_path))
768
769 def test_create_tmp(self, repetitions=10):
770 # Create files in tmp directory

Callers

nothing calls this directly

Calls 10

cleanMethod · 0.80
assertTrueMethod · 0.80
utimeMethod · 0.80
assertFalseMethod · 0.80
openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45
existsMethod · 0.45
statMethod · 0.45
timeMethod · 0.45

Tested by

no test coverage detected