Unit testing a function from conftest.py #8915
-
This is a very basic question but I wasn't able to find a relevant answer anywhere here My conftest.py has the helper inside, to auto-apply some markers
I would love to factor this method to live in a
Any tips on how to unit test this code? I could created baroque mocks but would prefer not to... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yeah One aspect that is often overlooked is that you don't need to test actual Item objects, but any object which implements the same interface/protocol. You can use |
Beta Was this translation helpful? Give feedback.
Yeah
Item
is not meant to be instantiated directly.One aspect that is often overlooked is that you don't need to test actual Item objects, but any object which implements the same interface/protocol.
You can use
mock.create_autospec
to create a mock object with the same interface.