mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-31 18:59:23 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			271 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			271 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import contextlib
 | |
| import os
 | |
| import pathlib
 | |
| from typing import Iterator
 | |
| 
 | |
| 
 | |
| @contextlib.contextmanager
 | |
| def isolated_filesystem(temp_dir: pathlib.Path) -> Iterator[None]:
 | |
|     cwd = os.getcwd()
 | |
| 
 | |
|     os.chdir(temp_dir)
 | |
|     try:
 | |
|         yield
 | |
|     finally:
 | |
|         os.chdir(cwd)
 | 
