gpt4 book ai didi

python - 在PyTest中如何配置CaptureManager插件错误 'CaptureManager'对象没有属性 'suspendcapture'

转载 作者:行者123 更新时间:2023-11-30 22:13:58 28 4
gpt4 key购买 nike

我从 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_capturingstop_global_capturingresume_global_capturesuspend_global_capture、``。

关于python - 在PyTest中如何配置CaptureManager插件错误 'CaptureManager'对象没有属性 'suspendcapture',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50638571/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com