Context manager to change the current working directory to `path`.
(path)
| 249 | |
| 250 | @contextlib.contextmanager |
| 251 | def pushd(path): |
| 252 | """ |
| 253 | Context manager to change the current working directory to `path`. |
| 254 | """ |
| 255 | original_cwd = os.getcwd() |
| 256 | if not path: |
| 257 | path = original_cwd |
| 258 | try: |
| 259 | os.chdir(path) |
| 260 | yield os.getcwd() |
| 261 | finally: |
| 262 | os.chdir(original_cwd) |
| 263 | |
| 264 | |
| 265 | def update_path_var(existing_path_var, new_path): |
no outgoing calls
no test coverage detected