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.
评论
?
参与讨论