Context manager to provide a temporary test folder. All arguments are passed as this to the underlying tempfile.mkdtemp function.
(*args, **kwargs)
| 1900 | |
| 1901 | @contextlib.contextmanager |
| 1902 | def tempdir(*args, **kwargs): |
| 1903 | """Context manager to provide a temporary test folder. |
| 1904 | |
| 1905 | All arguments are passed as this to the underlying tempfile.mkdtemp |
| 1906 | function. |
| 1907 | |
| 1908 | """ |
| 1909 | tmpdir = mkdtemp(*args, **kwargs) |
| 1910 | try: |
| 1911 | yield tmpdir |
| 1912 | finally: |
| 1913 | shutil.rmtree(tmpdir) |
| 1914 | |
| 1915 | |
| 1916 | @contextlib.contextmanager |
no outgoing calls