Skip to content

Commit

Permalink
Ignore prompt from "input" in Python
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Nov 9, 2023
1 parent aead200 commit 8971da6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tested/languages/python/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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")
Expand Down

0 comments on commit 8971da6

Please sign in to comment.