mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	packaging: use with open() instead of try/finally: close
This commit is contained in:
		
							parent
							
								
									0e3f3a7076
								
							
						
					
					
						commit
						21a9c748aa
					
				
					 11 changed files with 41 additions and 69 deletions
				
			
		|  | @ -54,11 +54,9 @@ def uses_local_files_for(server, url_path): | |||
|             url = server.full_address + url_path | ||||
|             request = urllib.request.Request(url) | ||||
|             response = urllib.request.urlopen(request) | ||||
|             file = open(PYPI_DEFAULT_STATIC_PATH + "/test_pypi_server" + | ||||
|                url_path) | ||||
|             answer = response.read().decode() == file.read() | ||||
|             file.close() | ||||
|             return answer | ||||
|             with open(PYPI_DEFAULT_STATIC_PATH + "/test_pypi_server" | ||||
|                       + url_path) as file: | ||||
|                 return response.read().decode() == file.read() | ||||
| 
 | ||||
|         server = PyPIServer(static_uri_paths=["simple", "external"], | ||||
|             static_filesystem_paths=["test_pypi_server"]) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner