Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi Team,
I'm trying to use pyunitt test with mock patch. I have placed my code in dataiku libraries.
When im calling this code with scenario it is giving error " ImportError : No module named mock"
here is my import :
import unittest
from unittest import TestCase, main, mock
Need help in how to use mock.
Hi,
Can you confirm if you are using Python2 or Python3? unittest is buil-in package.
However you may need to add mock to the "Packages to Install" list of the code env. Then use :
Steps to do so are discussed in this thread . Once you are sure mock is installed you can import like :
In Python 3:
import unittest.mock
in Python2 :
import mock
Let us know if that works for you.