mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	[3.13] gh-133454: Mark test_queue tests with many threads as bigmem (gh-134575) (GH-135047)
50 producer and 50 consumer threads need more than 5GB of memory.
(cherry picked from commit 7a79f52d83)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
			
			
This commit is contained in:
		
							parent
							
								
									7e2ebdbe9c
								
							
						
					
					
						commit
						f67dede253
					
				
					 1 changed files with 10 additions and 10 deletions
				
			
		| 
						 | 
					@ -7,7 +7,7 @@
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
import unittest
 | 
					import unittest
 | 
				
			||||||
import weakref
 | 
					import weakref
 | 
				
			||||||
from test.support import gc_collect
 | 
					from test.support import gc_collect, bigmemtest
 | 
				
			||||||
from test.support import import_helper
 | 
					from test.support import import_helper
 | 
				
			||||||
from test.support import threading_helper
 | 
					from test.support import threading_helper
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -964,33 +964,33 @@ def test_order(self):
 | 
				
			||||||
        # One producer, one consumer => results appended in well-defined order
 | 
					        # One producer, one consumer => results appended in well-defined order
 | 
				
			||||||
        self.assertEqual(results, inputs)
 | 
					        self.assertEqual(results, inputs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_many_threads(self):
 | 
					    @bigmemtest(size=50, memuse=100*2**20, dry_run=False)
 | 
				
			||||||
 | 
					    def test_many_threads(self, size):
 | 
				
			||||||
        # Test multiple concurrent put() and get()
 | 
					        # Test multiple concurrent put() and get()
 | 
				
			||||||
        N = 50
 | 
					 | 
				
			||||||
        q = self.q
 | 
					        q = self.q
 | 
				
			||||||
        inputs = list(range(10000))
 | 
					        inputs = list(range(10000))
 | 
				
			||||||
        results = self.run_threads(N, q, inputs, self.feed, self.consume)
 | 
					        results = self.run_threads(size, q, inputs, self.feed, self.consume)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Multiple consumers without synchronization append the
 | 
					        # Multiple consumers without synchronization append the
 | 
				
			||||||
        # results in random order
 | 
					        # results in random order
 | 
				
			||||||
        self.assertEqual(sorted(results), inputs)
 | 
					        self.assertEqual(sorted(results), inputs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_many_threads_nonblock(self):
 | 
					    @bigmemtest(size=50, memuse=100*2**20, dry_run=False)
 | 
				
			||||||
 | 
					    def test_many_threads_nonblock(self, size):
 | 
				
			||||||
        # Test multiple concurrent put() and get(block=False)
 | 
					        # Test multiple concurrent put() and get(block=False)
 | 
				
			||||||
        N = 50
 | 
					 | 
				
			||||||
        q = self.q
 | 
					        q = self.q
 | 
				
			||||||
        inputs = list(range(10000))
 | 
					        inputs = list(range(10000))
 | 
				
			||||||
        results = self.run_threads(N, q, inputs,
 | 
					        results = self.run_threads(size, q, inputs,
 | 
				
			||||||
                                   self.feed, self.consume_nonblock)
 | 
					                                   self.feed, self.consume_nonblock)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assertEqual(sorted(results), inputs)
 | 
					        self.assertEqual(sorted(results), inputs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_many_threads_timeout(self):
 | 
					    @bigmemtest(size=50, memuse=100*2**20, dry_run=False)
 | 
				
			||||||
 | 
					    def test_many_threads_timeout(self, size):
 | 
				
			||||||
        # Test multiple concurrent put() and get(timeout=...)
 | 
					        # Test multiple concurrent put() and get(timeout=...)
 | 
				
			||||||
        N = 50
 | 
					 | 
				
			||||||
        q = self.q
 | 
					        q = self.q
 | 
				
			||||||
        inputs = list(range(1000))
 | 
					        inputs = list(range(1000))
 | 
				
			||||||
        results = self.run_threads(N, q, inputs,
 | 
					        results = self.run_threads(size, q, inputs,
 | 
				
			||||||
                                   self.feed, self.consume_timeout)
 | 
					                                   self.feed, self.consume_timeout)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.assertEqual(sorted(results), inputs)
 | 
					        self.assertEqual(sorted(results), inputs)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue