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

Method _make_test_file

Lib/test/test_mmap.py:1234–1249  ·  view source on GitHub ↗
(self, num_zeroes, tail)

Source from the content-addressed store, hash-verified

1232 unlink(TESTFN)
1233
1234 def _make_test_file(self, num_zeroes, tail):
1235 if sys.platform[:3] == 'win' or is_apple:
1236 requires('largefile',
1237 'test requires %s bytes and a long time to run' % str(0x180000000))
1238 f = open(TESTFN, 'w+b')
1239 try:
1240 f.seek(num_zeroes)
1241 f.write(tail)
1242 f.flush()
1243 except (OSError, OverflowError, ValueError):
1244 try:
1245 f.close()
1246 except (OSError, OverflowError):
1247 pass
1248 raise unittest.SkipTest("filesystem does not have largefile support")
1249 return f
1250
1251 def test_large_offset(self):
1252 with self._make_test_file(0x14FFFFFFF, b" ") as f:

Callers 3

test_large_offsetMethod · 0.95
test_large_filesizeMethod · 0.95
_test_around_boundaryMethod · 0.95

Calls 7

requiresFunction · 0.90
strFunction · 0.85
openFunction · 0.50
seekMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected