From 8971da681e94a5ad650b0c53b043aa9559c49823 Mon Sep 17 00:00:00 2001 From: Niko Strijbol Date: Thu, 9 Nov 2023 15:00:15 +0100 Subject: [PATCH] Ignore prompt from "input" in Python --- tested/languages/python/generators.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tested/languages/python/generators.py b/tested/languages/python/generators.py index 82965aaa..450c7e45 100644 --- a/tested/languages/python/generators.py +++ b/tested/languages/python/generators.py @@ -141,6 +141,7 @@ def convert_execution_unit(pu: PreparedExecutionUnit) -> str: import sys import importlib from decimal import Decimal +import builtins """ # Import the language specific functions we will need. @@ -152,6 +153,14 @@ def convert_execution_unit(pu: PreparedExecutionUnit) -> str: value_file = open("{pu.value_file}", "w") exception_file = open("{pu.exception_file}", "w") + +# Overwrite the input function +__old_input = builtins.input +def _our_input(_prompt=None): + return __old_input() +builtins.input = _our_input + + def write_separator(): value_file.write("--{pu.testcase_separator_secret}-- SEP") exception_file.write("--{pu.testcase_separator_secret}-- SEP")