|
6 | 6 | import time
|
7 | 7 | import unittest
|
8 | 8 | import weakref
|
9 |
| -from test.support import gc_collect |
| 9 | +from test.support import gc_collect, bigmemtest |
10 | 10 | from test.support import import_helper
|
11 | 11 | from test.support import threading_helper
|
12 | 12 |
|
@@ -963,33 +963,33 @@ def test_order(self):
|
963 | 963 | # One producer, one consumer => results appended in well-defined order
|
964 | 964 | self.assertEqual(results, inputs)
|
965 | 965 |
|
966 |
| - def test_many_threads(self): |
| 966 | + @bigmemtest(size=50, memuse=100*2**20, dry_run=False) |
| 967 | + def test_many_threads(self, size): |
967 | 968 | # Test multiple concurrent put() and get()
|
968 |
| - N = 50 |
969 | 969 | q = self.q
|
970 | 970 | 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) |
972 | 972 |
|
973 | 973 | # Multiple consumers without synchronization append the
|
974 | 974 | # results in random order
|
975 | 975 | self.assertEqual(sorted(results), inputs)
|
976 | 976 |
|
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): |
978 | 979 | # Test multiple concurrent put() and get(block=False)
|
979 |
| - N = 50 |
980 | 980 | q = self.q
|
981 | 981 | inputs = list(range(10000))
|
982 |
| - results = self.run_threads(N, q, inputs, |
| 982 | + results = self.run_threads(size, q, inputs, |
983 | 983 | self.feed, self.consume_nonblock)
|
984 | 984 |
|
985 | 985 | self.assertEqual(sorted(results), inputs)
|
986 | 986 |
|
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): |
988 | 989 | # Test multiple concurrent put() and get(timeout=...)
|
989 |
| - N = 50 |
990 | 990 | q = self.q
|
991 | 991 | inputs = list(range(1000))
|
992 |
| - results = self.run_threads(N, q, inputs, |
| 992 | + results = self.run_threads(size, q, inputs, |
993 | 993 | self.feed, self.consume_timeout)
|
994 | 994 |
|
995 | 995 | self.assertEqual(sorted(results), inputs)
|
|
0 commit comments