mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-44958: Fix ref. leak introduced in GH-27844 (GH-28490)
Modify managed_connect() helper to support in-memory databases. Use it for the regression tests added in GH-27844. Automerge-Triggered-By: GH:pablogsal
This commit is contained in:
		
							parent
							
								
									050d103595
								
							
						
					
					
						commit
						3e3ff09058
					
				
					 2 changed files with 36 additions and 30 deletions
				
			
		|  | @ -38,13 +38,14 @@ | |||
| 
 | ||||
| # Helper for tests using TESTFN | ||||
| @contextlib.contextmanager | ||||
| def managed_connect(*args, **kwargs): | ||||
| def managed_connect(*args, in_mem=False, **kwargs): | ||||
|     cx = sqlite.connect(*args, **kwargs) | ||||
|     try: | ||||
|         yield cx | ||||
|     finally: | ||||
|         cx.close() | ||||
|         unlink(TESTFN) | ||||
|         if not in_mem: | ||||
|             unlink(TESTFN) | ||||
| 
 | ||||
| 
 | ||||
| class ModuleTests(unittest.TestCase): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Erlend Egeberg Aasland
						Erlend Egeberg Aasland