gpt4 book ai didi

python - 在 PyUnit 中运行任何测试之前,在开始时只运行一次方法

转载 作者:太空狗 更新时间:2023-10-30 00:08:15 25 4
gpt4 key购买 nike

我使用 PyUnit 为我的代码编写单元测试。每次运行任何测试之前都会调用设置方法。有没有一种方法可以定义一个方法,该方法将在开始时在运行任何测试之前只运行一次?

请帮忙谢谢你

最佳答案

您可以使用 setUpClass or setUpModule在 Python 2.7 和 3.2 中。

关于python - 在 PyUnit 中运行任何测试之前,在开始时只运行一次方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8240444/

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