Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-14821

Unit tests doesn't export scripts from common-services folder into PYTHONPATH

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0
    • Component/s: None
    • Labels:
      None

      Description

      When running unit tests with mocks like
      ---------------
      @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):
      ...
      ----------------

      the unit tests fail with the following 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

      ---------

      the source scripts from common-services are not getting exported into PYTHONPATH during unittest execution.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nalex Newton Alex
                Reporter:
                nalex Newton Alex
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: