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

Method test_del_on_close

Lib/test/test_tempfile.py:999–1009  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

997 "NamedTemporaryFile %s does not exist" % f.name)
998
999 def test_del_on_close(self):
1000 # A NamedTemporaryFile is deleted when closed
1001 dir = tempfile.mkdtemp()
1002 try:
1003 with tempfile.NamedTemporaryFile(dir=dir) as f:
1004 f.write(b'blat')
1005 self.assertEqual(os.listdir(dir), [])
1006 self.assertFalse(os.path.exists(f.name),
1007 "NamedTemporaryFile %s exists after close" % f.name)
1008 finally:
1009 os.rmdir(dir)
1010
1011 def test_dis_del_on_close(self):
1012 # Tests that delete-on-close can be disabled

Callers

nothing calls this directly

Calls 7

mkdtempMethod · 0.80
listdirMethod · 0.80
assertFalseMethod · 0.80
rmdirMethod · 0.80
writeMethod · 0.45
assertEqualMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected