Prepends the given path to `sys.path`. This method is intended to use with `with`, so after its usage, its value will be removed from `sys.path`.
(path: str)
| 82 | |
| 83 | @contextmanager |
| 84 | def push_python_path(path: str): |
| 85 | """ |
| 86 | Prepends the given path to `sys.path`. |
| 87 | This method is intended to use with `with`, so after its usage, its value |
| 88 | will be removed from `sys.path`. |
| 89 | """ |
| 90 | path = Path(path).resolve() |
| 91 | path = str(path) |
| 92 | sys.path.insert(0, path) |
| 93 | try: |
| 94 | yield |
| 95 | finally: |
| 96 | sys.path.remove(path) |
| 97 | |
| 98 | |
| 99 | def discover_file_plugins( |
no test coverage detected
searching dependent graphs…