ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fba...@apache.org
Subject ambari git commit: AMBARI-12177 Windows unit tests: Metrics unit tests: fix the imports & failing patches
Date Tue, 21 Jul 2015 18:36:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 1157dac6d -> 81b4febe6


AMBARI-12177 Windows unit tests: Metrics unit tests: fix the imports & failing patches

Fixed the imports. Coalesced the OS mock.


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/81b4febe
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/81b4febe
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/81b4febe

Branch: refs/heads/trunk
Commit: 81b4febe63f0f2e826664567e871a8fbebe0b9b7
Parents: 1157dac
Author: Florian Barca <fbarca@hortonworks.com>
Authored: Tue Jul 21 11:33:43 2015 -0700
Committer: Florian Barca <fbarca@hortonworks.com>
Committed: Tue Jul 21 11:35:31 2015 -0700

----------------------------------------------------------------------
 .../src/test/python/core/TestEmitter.py            | 17 +++++++----------
 .../src/test/python/core/TestMetricCollector.py    | 10 +++++-----
 .../src/test/python/unitTests.py                   |  8 +++++---
 3 files changed, 17 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/81b4febe/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py
b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py
index a9357fb..8f5236a 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestEmitter.py
@@ -23,21 +23,18 @@ import urllib2
 
 import logging
 from unittest import TestCase
-from only_for_platform import get_platform, PLATFORM_WINDOWS
+from only_for_platform import get_platform, os_distro_value, PLATFORM_WINDOWS
 
-from mock.mock import patch, MagicMock
+from ambari_commons.os_check import OSCheck
 
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from mock.mock import patch, MagicMock
 
 with patch("platform.linux_distribution", return_value = os_distro_value):
   from ambari_commons import OSCheck
-  from application_metric_map import ApplicationMetricMap
-  from config_reader import Configuration
-  from emitter import Emitter
-  from stop_handler import bind_signal_handlers
+  from core.application_metric_map import ApplicationMetricMap
+  from core.config_reader import Configuration
+  from core.emitter import Emitter
+  from core.stop_handler import bind_signal_handlers
 
 logger = logging.getLogger()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b4febe/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestMetricCollector.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestMetricCollector.py
b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestMetricCollector.py
index 30cc023..11a85eb 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestMetricCollector.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/core/TestMetricCollector.py
@@ -19,12 +19,12 @@ limitations under the License.
 '''
 import logging
 from unittest import TestCase
-
-from application_metric_map import ApplicationMetricMap
-from metric_collector import MetricsCollector
-from event_definition import HostMetricCollectEvent
 from mock.mock import patch
-from host_info import HostInfo
+
+from core.application_metric_map import ApplicationMetricMap
+from core.metric_collector import MetricsCollector
+from core.event_definition import HostMetricCollectEvent
+from core.host_info import HostInfo
 
 logger = logging.getLogger()
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b4febe/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/unitTests.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/unitTests.py b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/unitTests.py
index 3469de1..4ffaec8 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/unitTests.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/test/python/unitTests.py
@@ -53,16 +53,18 @@ def get_test_files(path, mask = None, recursive=True):
   """
   current = []
   directory_items = os.listdir(path)
+  directory_items.sort()
 
   for item in directory_items:
     add_to_pythonpath = False
-    if os.path.isfile(path + "/" + item):
+    item_path = os.path.join(path, item)
+    if os.path.isfile(item_path):
       if fnmatch.fnmatch(item, mask):
         add_to_pythonpath = True
         current.append(item)
-    elif os.path.isdir(path + "/" + item):
+    elif os.path.isdir(item_path):
       if recursive:
-        current.extend(get_test_files(path + "/" + item, mask = mask))
+        current.extend(get_test_files(item_path, mask = mask))
     if add_to_pythonpath:
       sys.path.append(path)
   return current


Mime
View raw message