Execute the tests and return the output as a string.
(code: str)
| 74 | |
| 75 | |
| 76 | def execute(code: str) -> str: |
| 77 | """Execute the tests and return the output as a string.""" |
| 78 | try: |
| 79 | result = subprocess.run( |
| 80 | code.split(), |
| 81 | capture_output=True, |
| 82 | text=True, |
| 83 | ) |
| 84 | if result.returncode != 0: |
| 85 | return f"Error: {result.stderr}" |
| 86 | return result.stdout |
| 87 | except Exception as e: |
| 88 | return f"Execution error: {str(e)}" |
no outgoing calls
no test coverage detected