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

Method test_clean

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

Source from the content-addressed store, hash-verified

743 self.assertEqual(self._box.list_folders(), [])
744
745 def test_clean(self):
746 # Remove old files from 'tmp'
747 foo_path = os.path.join(self._path, 'tmp', 'foo')
748 bar_path = os.path.join(self._path, 'tmp', 'bar')
749 with open(foo_path, 'w', encoding='utf-8') as f:
750 f.write("@")
751 with open(bar_path, 'w', encoding='utf-8') as f:
752 f.write("@")
753 self._box.clean()
754 self.assertTrue(os.path.exists(foo_path))
755 self.assertTrue(os.path.exists(bar_path))
756 foo_stat = os.stat(foo_path)
757 os.utime(foo_path, (time.time() - 129600 - 2,
758 foo_stat.st_mtime))
759 self._box.clean()
760 self.assertFalse(os.path.exists(foo_path))
761 self.assertTrue(os.path.exists(bar_path))
762
763 def test_create_tmp(self, repetitions=10):
764 # 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