Esempio n. 1
0
 def test_cleanup_path_dir_on_error(self):
     self.temp_dir = tempfile.mkdtemp()
     try:
         with _cleanup_path(self.temp_dir):
             raise RuntimeError()
     except:
         pass
     self.assertFalse(os.path.exists(self.temp_dir))
Esempio n. 2
0
 def test_cleanup_path_file_on_error(self):
     self.temp_file = tempfile.mkstemp()[1]
     try:
         with _cleanup_path(self.temp_file):
             raise RuntimeError()
     except:
         pass
     self.assertFalse(os.path.exists(self.temp_file))
Esempio n. 3
0
 def test_cleanup_path_file(self):
     self.temp_file = tempfile.mkstemp()[1]
     with _cleanup_path(self.temp_file):
         pass
     self.assertFalse(os.path.exists(self.temp_file))
Esempio n. 4
0
 def test_cleanup_path_dir(self):
     self.temp_dir = tempfile.mkdtemp()
     with _cleanup_path(self.temp_dir):
         pass
     self.assertFalse(os.path.exists(self.temp_dir))