| 590 | |
| 591 | |
| 592 | def test_open() -> None: |
| 593 | console = Console( |
| 594 | file=io.StringIO(), |
| 595 | force_terminal=True, |
| 596 | width=60, |
| 597 | color_system="truecolor", |
| 598 | legacy_windows=False, |
| 599 | _environ={}, |
| 600 | ) |
| 601 | progress = Progress( |
| 602 | console=console, |
| 603 | ) |
| 604 | |
| 605 | fd, filename = tempfile.mkstemp() |
| 606 | with os.fdopen(fd, "wb") as f: |
| 607 | f.write(b"Hello, World!") |
| 608 | try: |
| 609 | with rich.progress.open(filename) as f: |
| 610 | assert f.read() == "Hello, World!" |
| 611 | assert f.closed |
| 612 | finally: |
| 613 | os.remove(filename) |
| 614 | |
| 615 | |
| 616 | def test_open_text_mode() -> None: |