mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	bpo-33613: Fix test_semaphore_tracker signal tests when using -Werror (GH-9778)
Tests involving sending signals to the semaphore_tracker will not fail anymore due to the fact that running the test suite with -Werror propagates warnings as errors. Fix a missing assertion when the semaphore_tracker is expected to die.
This commit is contained in:
		
							parent
							
								
									d0bb5d73cb
								
							
						
					
					
						commit
						3058b7d856
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -4548,7 +4548,8 @@ def check_semaphore_tracker_death(self, signum, should_die):
 | 
				
			||||||
        if pid is not None:
 | 
					        if pid is not None:
 | 
				
			||||||
            os.kill(pid, signal.SIGKILL)
 | 
					            os.kill(pid, signal.SIGKILL)
 | 
				
			||||||
            os.waitpid(pid, 0)
 | 
					            os.waitpid(pid, 0)
 | 
				
			||||||
        with warnings.catch_warnings(record=True) as all_warn:
 | 
					        with warnings.catch_warnings():
 | 
				
			||||||
 | 
					            warnings.simplefilter("ignore")
 | 
				
			||||||
            _semaphore_tracker.ensure_running()
 | 
					            _semaphore_tracker.ensure_running()
 | 
				
			||||||
        pid = _semaphore_tracker._pid
 | 
					        pid = _semaphore_tracker._pid
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4557,6 +4558,7 @@ def check_semaphore_tracker_death(self, signum, should_die):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ctx = multiprocessing.get_context("spawn")
 | 
					        ctx = multiprocessing.get_context("spawn")
 | 
				
			||||||
        with warnings.catch_warnings(record=True) as all_warn:
 | 
					        with warnings.catch_warnings(record=True) as all_warn:
 | 
				
			||||||
 | 
					            warnings.simplefilter("always")
 | 
				
			||||||
            sem = ctx.Semaphore()
 | 
					            sem = ctx.Semaphore()
 | 
				
			||||||
            sem.acquire()
 | 
					            sem.acquire()
 | 
				
			||||||
            sem.release()
 | 
					            sem.release()
 | 
				
			||||||
| 
						 | 
					@ -4569,7 +4571,7 @@ def check_semaphore_tracker_death(self, signum, should_die):
 | 
				
			||||||
            if should_die:
 | 
					            if should_die:
 | 
				
			||||||
                self.assertEqual(len(all_warn), 1)
 | 
					                self.assertEqual(len(all_warn), 1)
 | 
				
			||||||
                the_warn = all_warn[0]
 | 
					                the_warn = all_warn[0]
 | 
				
			||||||
                issubclass(the_warn.category, UserWarning)
 | 
					                self.assertTrue(issubclass(the_warn.category, UserWarning))
 | 
				
			||||||
                self.assertTrue("semaphore_tracker: process died"
 | 
					                self.assertTrue("semaphore_tracker: process died"
 | 
				
			||||||
                                in str(the_warn.message))
 | 
					                                in str(the_warn.message))
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue