I have a Python Flask Blueprint called api, and within it, it has a file called utils that has a function I am trying to Mock. The path to that utils file is "app/api/utils.py", and the function I'm trying to mock is "is_file_writeable()".
I am running a test for a route in the Blueprint located at "app/api/configs.py". Within configs.py, I import the function as so: from app.api.utils import is_file_writeable
I have tried the following patch decorators: @patch('app.api.configs.is_file_writeable', return_value=False) and @patch('app.api.utils.is_file_writeable', return_value=False)
Both return the following errors respectively: AttributeError: 'Blueprint' object has no attribute 'configs' and AttributeError: 'Blueprint' object has no attribute 'utils'
Any ideas as to why I am getting an import error?
Thank you for your help.
Aucun commentaire:
Enregistrer un commentaire