Parametrizing Pytest Fixtures

Parametrizing pytest fixtures is a powerful technique for writing more concise and readable tests. I find parametrizing fixtures helpful in two cases.

• When testing multiple implementations of the same interface.

• When testing the same function against different inputs.

Testing interface implementations

Thanks to Python duck typing, you don’t have to explicitly define interfaces. Any object that has the required attributes and methods can be used as an interface implementation.

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论