Exemplo n.º 1
0
 def test_temp_file_removes(self):
     foo = NamedTemporaryFile(suffix='foo.txt', delete=True)
     full_path = foo.temporary_file_path()
     path, name = os.path.split(full_path)
     self.assertRegexpMatches(name, r'\w+foo.txt')
     foo.close()
     self.assertFalse(os.path.isfile(full_path))
Exemplo n.º 2
0
 def test_temp_file_removes_manually(self):
     foo = NamedTemporaryFile(suffix='foo.txt', delete=False)
     full_path = foo.temporary_file_path()
     os.remove(full_path)
     self.assertFalse(os.path.isfile(full_path))
     # although removed, shouldn't raise an error
     foo.close()
Exemplo n.º 3
0
 def test_temp_file_removes(self):
     foo = NamedTemporaryFile(suffix='foo.txt', delete=True)
     full_path = foo.temporary_file_path()
     path, name = os.path.split(full_path)
     self.assertRegexpMatches(name, r'\w+foo.txt')
     foo.close()
     self.assertFalse(os.path.isfile(full_path))
Exemplo n.º 4
0
 def test_temp_file_removes_manually(self):
     foo = NamedTemporaryFile(suffix='foo.txt', delete=False)
     full_path = foo.temporary_file_path()
     os.remove(full_path)
     self.assertFalse(os.path.isfile(full_path))
     # although removed, shouldn't raise an error
     foo.close()
Exemplo n.º 5
0
 def test_temp_file_keeps(self):
     foo = NamedTemporaryFile(suffix='foo.txt', delete=False)
     full_path = foo.temporary_file_path()
     foo.close()
     self.assertTrue(os.path.isfile(full_path))
Exemplo n.º 6
0
 def test_temp_file_keeps(self):
     foo = NamedTemporaryFile(suffix='foo.txt', delete=False)
     full_path = foo.temporary_file_path()
     foo.close()
     self.assertTrue(os.path.isfile(full_path))