Wrapper making a temporary directory available.
()
| 33 | |
| 34 | @contextlib.contextmanager |
| 35 | def temp_dir(): |
| 36 | """Wrapper making a temporary directory available.""" |
| 37 | path = None |
| 38 | try: |
| 39 | path = Path(tempfile.mkdtemp('_v8_test')) |
| 40 | yield path |
| 41 | finally: |
| 42 | if path: |
| 43 | shutil.rmtree(path) |
| 44 | |
| 45 | |
| 46 | @contextlib.contextmanager |