(root)
| 61 | |
| 62 | @contextlib.contextmanager |
| 63 | def chdir(root): |
| 64 | if root == ".": |
| 65 | yield |
| 66 | return |
| 67 | cwd = os.getcwd() |
| 68 | os.chdir(root) |
| 69 | try: |
| 70 | yield |
| 71 | except BaseException as exc: |
| 72 | raise exc |
| 73 | finally: |
| 74 | os.chdir(cwd) |
| 75 | |
| 76 | |
| 77 | class TimeoutException(Exception): |