The Python Oracle

patching a class yields "AttributeError: Mock object has no attribute" when accessing instance attributes

This video explains
patching a class yields "AttributeError: Mock object has no attribute" when accessing instance attributes

--

Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Ocean Floor

--

Chapters
00:00 Question
03:45 Accepted answer (Score 73)
05:29 Answer 2 (Score 0)
05:58 Thank you

--

Full question
https://stackoverflow.com/questions/3170...

Question links:
[http://mock.readthedocs.org/en/latest/he...]: http://mock.readthedocs.org/en/latest/he...
[http://mock.readthedocs.org/en/latest/pa...]: http://mock.readthedocs.org/en/latest/pa...

Accepted answer links:
[documentation you read]: https://docs.python.org/3/library/unitte...

Answer 2 links:
[https://docs.python.org/3/library/unitte...]: https://docs.python.org/3/library/unitte...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #unittesting #attributes #mocking #pythonunittest

#avk47