如何编写一个unittest
,它会在合适的时间按下一个键,以便我可以测试下面的check
方法,并且它不会永远等待按键。
class MyProject():
def __init__(self):
self.info = ""
def check(self):
# goes online to fetch data and saves it to self.info
input("Press any key to continue...")
def main_function(self):
# this method does the main task