mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	[3.9] bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005). (GH-28028)
(cherry picked from commit 2a8127cafe)
			
			
This commit is contained in:
		
							parent
							
								
									dab74d68e3
								
							
						
					
					
						commit
						330aabbbbe
					
				
					 36 changed files with 143 additions and 15 deletions
				
			
		|  | @ -2,7 +2,7 @@ | |||
| import unittest | ||||
| import tkinter | ||||
| from tkinter import ttk | ||||
| from test.support import requires, run_unittest | ||||
| from test.support import requires, run_unittest, gc_collect | ||||
| from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest | ||||
| 
 | ||||
| requires('gui') | ||||
|  | @ -18,6 +18,7 @@ def test_widget_destroy(self): | |||
|         x = ttk.LabeledScale(self.root) | ||||
|         var = x._variable._name | ||||
|         x.destroy() | ||||
|         gc_collect()  # For PyPy or other GCs. | ||||
|         self.assertRaises(tkinter.TclError, x.tk.globalgetvar, var) | ||||
| 
 | ||||
|         # manually created variable | ||||
|  | @ -30,6 +31,7 @@ def test_widget_destroy(self): | |||
|         else: | ||||
|             self.assertEqual(float(x.tk.globalgetvar(name)), myvar.get()) | ||||
|         del myvar | ||||
|         gc_collect()  # For PyPy or other GCs. | ||||
|         self.assertRaises(tkinter.TclError, x.tk.globalgetvar, name) | ||||
| 
 | ||||
|         # checking that the tracing callback is properly removed | ||||
|  | @ -171,6 +173,7 @@ def test_variable_change(self): | |||
|     def test_resize(self): | ||||
|         x = ttk.LabeledScale(self.root) | ||||
|         x.pack(expand=True, fill='both') | ||||
|         gc_collect()  # For PyPy or other GCs. | ||||
|         x.update() | ||||
| 
 | ||||
|         width, height = x.master.winfo_width(), x.master.winfo_height() | ||||
|  | @ -206,6 +209,7 @@ def test_widget_destroy(self): | |||
|         optmenu.destroy() | ||||
|         self.assertEqual(optmenu.tk.globalgetvar(name), var.get()) | ||||
|         del var | ||||
|         gc_collect()  # For PyPy or other GCs. | ||||
|         self.assertRaises(tkinter.TclError, optmenu.tk.globalgetvar, name) | ||||
| 
 | ||||
| 
 | ||||
|  | @ -251,6 +255,7 @@ def test_menu(self): | |||
| 
 | ||||
|         # check that variable is updated correctly | ||||
|         optmenu.pack() | ||||
|         gc_collect()  # For PyPy or other GCs. | ||||
|         optmenu['menu'].invoke(0) | ||||
|         self.assertEqual(optmenu._variable.get(), items[0]) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka