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

Method test_del_on_collection

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

Source from the content-addressed store, hash-verified

1845
1846 @support.cpython_only
1847 def test_del_on_collection(self):
1848 # A TemporaryDirectory is deleted when garbage collected
1849 dir = tempfile.mkdtemp()
1850 try:
1851 d = self.do_create(dir=dir)
1852 name = d.name
1853 del d # Rely on refcounting to invoke __del__
1854 self.assertFalse(os.path.exists(name),
1855 "TemporaryDirectory %s exists after __del__" % name)
1856 finally:
1857 os.rmdir(dir)
1858
1859 @support.cpython_only
1860 def test_del_on_collection_ignore_errors(self):

Callers

nothing calls this directly

Calls 5

do_createMethod · 0.95
mkdtempMethod · 0.80
assertFalseMethod · 0.80
rmdirMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected