Skip to content

Unit testing a function from conftest.py #8915

Answered by nicoddemus
jandom asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jandom
Comment options

Answer selected by jandom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants