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