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

Method test_del_rolled_file

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

Source from the content-addressed store, hash-verified

1259 f.__del__()
1260
1261 def test_del_rolled_file(self):
1262 # The rolled file should be deleted when the SpooledTemporaryFile
1263 # object is deleted. This should raise a ResourceWarning since the file
1264 # was not explicitly closed.
1265 f = self.do_create(max_size=2)
1266 f.write(b'foo')
1267 name = f.name # This is a fd on posix+cygwin, a filename everywhere else
1268 self.assertTrue(os.path.exists(name))
1269 with self.assertWarns(ResourceWarning):
1270 f.__del__()
1271 self.assertFalse(
1272 os.path.exists(name),
1273 "Rolled SpooledTemporaryFile (name=%s) exists after delete" % name
1274 )
1275
1276 def test_rewrite_small(self):
1277 # A SpooledTemporaryFile can be written to multiple within the max_size

Callers

nothing calls this directly

Calls 7

do_createMethod · 0.95
assertTrueMethod · 0.80
assertWarnsMethod · 0.80
assertFalseMethod · 0.80
writeMethod · 0.45
existsMethod · 0.45
__del__Method · 0.45

Tested by

no test coverage detected