在 PyTest 中如何配置 CaptureManager 插件错误 'CaptureManager' object has no attribute 'suspendcapture'
In PyTest how to config CaptureManager plugin error 'CaptureManager' object has no attribute 'suspendcapture'
我从 pytest 调用了以下函数。
def ask_user_input(msg=''):
""" Asks user to check something manually and answer a question """
notification = "\n\n???\tANSWER NEEDED\t???\n\n{}".format(msg)
# suspend input capture by py.test so user input can be recorded here
capture_manager = pytest.config.pluginmanager.getplugin('capturemanager')
capture_manager.suspendcapture(in_=True)
answer = input(notification)
# resume capture after question have been asked
capture_manager.resumecapture()
logging.debug("Answer: {}".format(answer))
return answer
但是,我收到以下错误:
错误:AttributeError:'CaptureManager'对象没有属性'suspendcapture'
我正在使用 Python 3.6+。我如何使用 CaptureManager,因为上面示例中的 pytest.config 似乎不再存在。
'CaptureManager' object has no attribute 'suspendcapture'
没错。这些方法现在称为 "global":start_global_capturing
、stop_global_capturing
、resume_global_capture
、suspend_global_capture
、``.
我从 pytest 调用了以下函数。
def ask_user_input(msg=''):
""" Asks user to check something manually and answer a question """
notification = "\n\n???\tANSWER NEEDED\t???\n\n{}".format(msg)
# suspend input capture by py.test so user input can be recorded here
capture_manager = pytest.config.pluginmanager.getplugin('capturemanager')
capture_manager.suspendcapture(in_=True)
answer = input(notification)
# resume capture after question have been asked
capture_manager.resumecapture()
logging.debug("Answer: {}".format(answer))
return answer
但是,我收到以下错误: 错误:AttributeError:'CaptureManager'对象没有属性'suspendcapture'
我正在使用 Python 3.6+。我如何使用 CaptureManager,因为上面示例中的 pytest.config 似乎不再存在。
'CaptureManager' object has no attribute 'suspendcapture'
没错。这些方法现在称为 "global":start_global_capturing
、stop_global_capturing
、resume_global_capture
、suspend_global_capture
、``.