Hi Newton

Looks like the module *hawqmaster *is not found in the path. The PYTHONPATH
might not have the path where it can find *hawqmaster* module.

Looking into the code here
https://github.com/apache/ambari/blob/trunk/ambari-server/src/test/python/unitTests.py#L145-#L153
might help you figure out if an additional python path needs to be set for
the hawqmaster module.


Regards
Matt

On Fri, Jan 22, 2016 at 11:11 AM, Newton Alex <[email protected]> wrote:

> Hello Ambari developers,
>
> Ref: https://issues.apache.org/jira/browse/AMBARI-13439
> I need some help with the stack unit test code. I added some unit tests to
> HAWQ service that included mocking some functions from within the service
> plugin code:
>
> E.g:
>
> ---------------
>   @patch ('hawqmaster.common.__set_osparams')
>   @patch ('hawqmaster.master_helper.__is_active_master')
>   @patch ('hawqmaster.master_helper.__is_local_initialized')
>   def test_start_default(self, is_local_initialized_mock,
> active_master_mock, set_osparams_mock):
> ...
> ----------------
>
> But the python mock library is unable to find the HAWQ service plugin files
> and fails with the following error msg:
>
> --------
>
> Failed tests:
> ERROR: test_configure_default (test_hawqmaster.TestHawqMaster)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File
> "/home/jenkins/jenkins-slave/workspace/Ambari-trunk-test-patch/ambari/ambari-common/src/test/python/mock/mock.py",
> line 1191, in patched
>     arg = patching.__enter__()
>   File
> "/home/jenkins/jenkins-slave/workspace/Ambari-trunk-test-patch/ambari/ambari-common/src/test/python/mock/mock.py",
> line 1250, in __enter__
>     self.target = self.getter()
>   File
> "/home/jenkins/jenkins-slave/workspace/Ambari-trunk-test-patch/ambari/ambari-common/src/test/python/mock/mock.py",
> line 1412, in <lambda>
>     getter = lambda: _importer(target)
>   File
> "/home/jenkins/jenkins-slave/workspace/Ambari-trunk-test-patch/ambari/ambari-common/src/test/python/mock/mock.py",
> line 1096, in _importer
>     thing = __import__(import_path)
> ImportError: No module named hawqmaster
>
>
> ---------
>
> It seems to work fine if I explicitly export the $PYTHONPATH to the .../
> common-services/HAWQ/2.0.0/packages/scripts folder and run the unit test
> manually.
>
> I'd greatly appreciate any help or suggestion on how to go about fixing
> this problem.
>
> Thanks,
> Newton
>



-- 
*Mithun Mathew* (Matt)

   - www.linkedin.com/in/mithunmatt/

Reply via email to