pytest的执行顺序

一、相关库推荐
rich 打印更好
loguru 日志库

二、
一个py.文件
setupmodule (最优先运行的,不能放在class内部,模块级别)

class:
  setup_class(类级别)
    setup_method(方法级别)
    teardown_method
    test_a
    test_b
  teardown_class

teardownmodule

执行顺序
setup_class
setup_method
test_a
teardown_method
setup_method
test_b
teardown_method
teardown_calss
teardownmodule

三、
py test-s 允许打印print


四、
记得每个文件import pytets

posted @ 2023-05-12 15:50  moon_p  阅读(87)  评论(0)    收藏  举报