4.1 执行单个测试函数

执行单个测试函数又分为执行测试文件中的单个函数和执行测试文件中测试类中的一个测试方法

4.1.1 执行测试文件中的单个测试函数

执行测试文件中的测试函数的方法就是指定测试文件和测试函数名,测试文件和测试函数名之间使用两个冒号,举例如下(https://gitee.com/redrose2100/pytest-demo/blob/master/ch04/ex_001/test_demo.py)

def test_01():
    print("in test_01 ...")
    assert 1==1

def test_02():
    print("in test_02 ...")
    assert 1

猜你喜欢

转载自blog.csdn.net/redrose2100/article/details/125355720