Skip to content

Commit 2c66c93

Browse files
remove resize tests
1 parent 8948ed8 commit 2c66c93

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

‎Lib/test/test_free_threading/test_mmap.py‎

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -195,27 +195,6 @@ def item_update_and_item_read(mm_obj):
195195
nthreads=NTHREADS,
196196
)
197197

198-
@unittest.skipUnless(os.name == "posix", "requires Posix")
199-
@unittest.skipUnless(hasattr(mmap.mmap, "resize"), "requires mmap.resize")
200-
def test_resize_and_size(self):
201-
thread_indexes = [i for i in range(NTHREADS)]
202-
203-
def resize_and_item_update(mm_obj):
204-
# Each thread picks a unique index to write
205-
thread_index = thread_indexes.pop()
206-
mm_obj.resize(2048)
207-
self.assertEqual(mm_obj.size(), 2048)
208-
for i in range(100):
209-
mm_obj[thread_index] = i
210-
self.assertEqual(mm_obj[thread_index], i)
211-
212-
with mmap.mmap(ANONYMOUS_MEM, 1024, flags=mmap.MAP_PRIVATE) as mm_obj:
213-
run_concurrently(
214-
worker_func=resize_and_item_update,
215-
args=(mm_obj,),
216-
nthreads=NTHREADS,
217-
)
218-
219198
def test_close_and_closed(self):
220199
def close_mmap(mm_obj):
221200
mm_obj.close()
@@ -251,30 +230,6 @@ def find_and_rfind(mm_obj):
251230
nthreads=NTHREADS,
252231
)
253232

254-
@unittest.skipUnless(os.name == "posix", "requires Posix")
255-
@unittest.skipUnless(hasattr(mmap.mmap, "resize"), "requires mmap.resize")
256-
def test_flush(self):
257-
mmap_filename = "test_mmap_file"
258-
resize_to = 1024
259-
260-
def resize_and_flush(mm_obj):
261-
mm_obj.resize(resize_to)
262-
mm_obj.flush()
263-
264-
with tempfile.TemporaryDirectory() as tmpdirname:
265-
file_path = f"{tmpdirname}/{mmap_filename}"
266-
with open(file_path, "wb+") as file:
267-
file.write(b"CPython")
268-
file.flush()
269-
with mmap.mmap(file.fileno(), 1) as mm_obj:
270-
run_concurrently(
271-
worker_func=resize_and_flush,
272-
args=(mm_obj,),
273-
nthreads=NTHREADS,
274-
)
275-
276-
self.assertEqual(os.path.getsize(file_path), resize_to)
277-
278233
def test_mmap_export_as_memoryview(self):
279234
"""
280235
Each thread creates a memoryview and updates the internal state of the

0 commit comments

Comments
 (0)