是否有一个pytest钩子,该钩子在上下文管理器的__exit__方法之前执行?

时间:2019-12-09 13:47:13

标签: python pytest

我的任务是制作例外屏幕截图。 由于我使用上下文管理器进入会话,因此需要在上下文管理器的 12:52:58,674 WARN [XmlBeanDefinitionReader] Ignored XML validation warning org.xml.sax.SAXParseException; lineNumber: 31; columnNumber: 70; schema_reference.4: Failed to read schema document 'https://www.springframework.org/schema/tx/spring-tx.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. 方法之前(在退出会话之前)进行屏幕截图。我为pytest找到的钩子是在__exit__之后执行的。是否有一些我不知道的钩子是在__exit__之前的异常中执行的?

我尝试过__exit__pytest_runtest_teardown等。

谢谢

0 个答案:

没有答案