我正在使用 eclipse 并且试图在我的单元测试类中只运行 1 个测试函数,而不是每次都运行所有函数。我该怎么做?这是我的测试类的样子:
import unittest
from X import func1
from X import func2
class XTest(unittest.TestCase):
def test_firstTest(self):
assertEqual(func1(), "hello")
def test_secondTest(self):
assertEqual(func2(), "bye")
if __name__ == "__main__":
unittest.main()
在 Eclipse 中,如果我将其作为 python 单元测试运行,则两个测试函数都会运行。我只想运行其中一个功能。例如,只有 test_firsttest。抱歉,如果这很简单,我是 Python 新手。