new_callable class not being used when trying to mock entire class #8492
Answered
by
charlie2clarke
charlie2clarke
asked this question in
Q&A
-
I'm new to testing and GitHub, so am not 100% sure if this is the right place to be asking but I have a University deadline coming up and I've been stuck on this for some time now, so was wondering if anyone could tell me what I am doing wrong. In the class I am testing, I want to mock the whole DataAccess class that is used as a member variable. The DataAccess class is just abstracting the SQLite database connection. I have created a replacement MockDataAccess class that connects to a test database, but the main database still seems to be called - what is wrong with this patch? Class to test:
My test class:
|
Beta Was this translation helpful? Give feedback.
Answered by
charlie2clarke
Mar 29, 2021
Replies: 1 comment
Answer selected by
charlie2clarke
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solved - https://stackoverflow.com/questions/66732906/pytest-mock-new-callable-class-not-being-used-when-trying-to-mock-whole-class