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

Method test_crasher_on_windows

Lib/test/test_mmap.py:734–758  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

732
733 @unittest.skipUnless(os.name == 'nt', 'requires Windows')
734 def test_crasher_on_windows(self):
735 # Should not crash (Issue 1733986)
736 tagname = random_tagname()
737 m = mmap.mmap(-1, 1000, tagname=tagname)
738 try:
739 mmap.mmap(-1, 5000, tagname=tagname)[:] # same tagname, but larger size
740 except:
741 pass
742 m.close()
743
744 # Should not crash (Issue 5385)
745 with open(TESTFN, "wb") as fp:
746 fp.write(b"x"*10)
747 f = open(TESTFN, "r+b")
748 m = mmap.mmap(f.fileno(), 0)
749 f.close()
750 try:
751 m.resize(0) # will raise OSError
752 except:
753 pass
754 try:
755 m[:]
756 except:
757 pass
758 m.close()
759
760 @unittest.skipUnless(os.name == 'nt', 'requires Windows')
761 def test_invalid_descriptor(self):

Callers

nothing calls this directly

Calls 6

random_tagnameFunction · 0.85
openFunction · 0.50
closeMethod · 0.45
writeMethod · 0.45
filenoMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected