Survey banner
The Dataiku Community is moving to a new home! We are temporary in read only mode: LEARN MORE

pyunitt test for mock patch in dataiku

Level 1
pyunitt test for mock patch in dataiku

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.

0 Kudos
1 Reply


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. 

0 Kudos