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

Method test_dis_del_on_close

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

Source from the content-addressed store, hash-verified

1028 os.rmdir(dir)
1029
1030 def test_dis_del_on_close(self):
1031 # Tests that delete-on-close can be disabled
1032 dir = tempfile.mkdtemp()
1033 tmp = None
1034 try:
1035 f = tempfile.NamedTemporaryFile(dir=dir, delete=False)
1036 tmp = f.name
1037 f.write(b'blat')
1038 f.close()
1039 self.assertTrue(os.path.exists(f.name),
1040 "NamedTemporaryFile %s missing after close" % f.name)
1041 finally:
1042 if tmp is not None:
1043 os.unlink(tmp)
1044 os.rmdir(dir)
1045
1046 def test_multiple_close(self):
1047 # A NamedTemporaryFile can be closed many times without error

Callers

nothing calls this directly

Calls 7

mkdtempMethod · 0.80
assertTrueMethod · 0.80
rmdirMethod · 0.80
writeMethod · 0.45
closeMethod · 0.45
existsMethod · 0.45
unlinkMethod · 0.45

Tested by

no test coverage detected