Create an empty, named, temporary file for the duration of the context.
(name)
| 420 | |
| 421 | @contextmanager |
| 422 | def make_tempfile(name): |
| 423 | """ Create an empty, named, temporary file for the duration of the context. |
| 424 | """ |
| 425 | open(name, 'w').close() |
| 426 | try: |
| 427 | yield |
| 428 | finally: |
| 429 | os.unlink(name) |
| 430 | |
| 431 | def fake_input(inputs): |
| 432 | """Temporarily replace the input() function to return the given values |