(debug)
| 10 | |
| 11 | @pytest.fixture(scope="function") |
| 12 | def sandbox(debug): |
| 13 | # Create a new sandbox instance for each test |
| 14 | sandbox = Sandbox.create(timeout=timeout) |
| 15 | |
| 16 | try: |
| 17 | yield sandbox |
| 18 | finally: |
| 19 | # Ensure proper cleanup |
| 20 | try: |
| 21 | sandbox.kill() |
| 22 | except Exception as e: |
| 23 | if not debug: |
| 24 | logger.warning( |
| 25 | f"Failed to kill sandbox — this is expected if the test runs with local envd. Error: {e}" |
| 26 | ) |
| 27 | |
| 28 | |
| 29 | @pytest.fixture |