Coverage for skema/utils/change_dir_back.py: 0%

9 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-30 17:15 +0000

1import os 

2def change_dir_back(this_path): 

3 """Decorator to ensure the working directory is changed back after function call.""" 

4 def outer_decorator(func): 

5 def inner_decorator(*args, **kwargs): 

6 try: 

7 return func(*args, **kwargs) 

8 finally: 

9 os.chdir(this_path) 

10 

11 return inner_decorator 

12 return outer_decorator