Skip to content

Commit 7a79f52

Browse files
gh-133454: Mark test_queue tests with many threads as bigmem (gh-134575)
50 producer and 50 consumer threads need more than 5GB of memory.
1 parent c7051a3 commit 7a79f52

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Lib/test/test_queue.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import time
77
import unittest
88
import weakref
9-
from test.support import gc_collect
9+
from test.support import gc_collect, bigmemtest
1010
from test.support import import_helper
1111
from test.support import threading_helper
1212

@@ -963,33 +963,33 @@ def test_order(self):
963963
# One producer, one consumer => results appended in well-defined order
964964
self.assertEqual(results, inputs)
965965

966-
def test_many_threads(self):
966+
@bigmemtest(size=50, memuse=100*2**20, dry_run=False)
967+
def test_many_threads(self, size):
967968
# Test multiple concurrent put() and get()
968-
N = 50
969969
q = self.q
970970
inputs = list(range(10000))
971-
results = self.run_threads(N, q, inputs, self.feed, self.consume)
971+
results = self.run_threads(size, q, inputs, self.feed, self.consume)
972972

973973
# Multiple consumers without synchronization append the
974974
# results in random order
975975
self.assertEqual(sorted(results), inputs)
976976

977-
def test_many_threads_nonblock(self):
977+
@bigmemtest(size=50, memuse=100*2**20, dry_run=False)
978+
def test_many_threads_nonblock(self, size):
978979
# Test multiple concurrent put() and get(block=False)
979-
N = 50
980980
q = self.q
981981
inputs = list(range(10000))
982-
results = self.run_threads(N, q, inputs,
982+
results = self.run_threads(size, q, inputs,
983983
self.feed, self.consume_nonblock)
984984

985985
self.assertEqual(sorted(results), inputs)
986986

987-
def test_many_threads_timeout(self):
987+
@bigmemtest(size=50, memuse=100*2**20, dry_run=False)
988+
def test_many_threads_timeout(self, size):
988989
# Test multiple concurrent put() and get(timeout=...)
989-
N = 50
990990
q = self.q
991991
inputs = list(range(1000))
992-
results = self.run_threads(N, q, inputs,
992+
results = self.run_threads(size, q, inputs,
993993
self.feed, self.consume_timeout)
994994

995995
self.assertEqual(sorted(results), inputs)

0 commit comments

Comments
 (0)