【开发也是好测试系列】(二)——pytest之fixture

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010924834/article/details/74014913

导读

fixture是pytest中的一个重要概念,本篇文章中让我们来了解并总结一下fixture。

定义


  • decorator

@pytest.fixture看起来像是Java中的annotation,实际上它有个独特的名字—-decorator。decorator是Python中的语法糖(Syntactic Sugar)

@decorator
def function():
    pass

is syntactic sugar for

def function():
    pass
function = decorator(function)
  • fff

    dffaljfa

  • fff

    dffaljfa

猜你喜欢

转载自blog.csdn.net/u010924834/article/details/74014913
今日推荐