ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject ambari git commit: AMBARI-10166. Enable python unit tests to run on Mac
Date Fri, 20 Mar 2015 23:59:37 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e514c9be3 -> b681b55a9


AMBARI-10166. Enable python unit tests to run on Mac


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

Branch: refs/heads/trunk
Commit: b681b55a956f51faa7a23ecfeaa07a7e5d577787
Parents: e514c9b
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Fri Mar 20 16:59:16 2015 -0700
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Fri Mar 20 16:59:16 2015 -0700

----------------------------------------------------------------------
 ambari-agent/src/test/python/ambari_agent/TestActionQueue.py | 4 ++--
 ambari-agent/src/test/python/ambari_agent/TestController.py  | 4 ++--
 ambari-agent/src/test/python/unitTests.py                    | 2 +-
 ambari-common/src/main/python/ambari_commons/os_check.py     | 6 ++++++
 4 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b681b55a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
index 6c14e33..6e445c1 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
@@ -37,7 +37,7 @@ from ambari_agent.CommandStatusDict import CommandStatusDict
 from ambari_agent.ActualConfigHandler import ActualConfigHandler
 from FileCache import FileCache
 from ambari_commons import OSCheck
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
+from only_for_platform import only_for_platform, get_platform, not_for_platform, PLATFORM_LINUX,
PLATFORM_WINDOWS
 
 if get_platform() != PLATFORM_WINDOWS:
   os_distro_value = ('Suse','11','Final')
@@ -661,7 +661,7 @@ class TestActionQueue(TestCase):
     report = actionQueue.result()
     self.assertEqual(len(report['reports']),1)
 
-  @only_for_platform(PLATFORM_LINUX)
+  @not_for_platform(PLATFORM_WINDOWS)
   @patch.object(CustomServiceOrchestrator, "resolve_script_path")
   @patch.object(StackVersionsFileHandler, "read_stack_version")
   def test_execute_python_executor(self, read_stack_version_mock, resolve_script_path_mock):

http://git-wip-us.apache.org/repos/asf/ambari/blob/b681b55a/ambari-agent/src/test/python/ambari_agent/TestController.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestController.py b/ambari-agent/src/test/python/ambari_agent/TestController.py
index e2fd7a7..0c9144e 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestController.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestController.py
@@ -29,7 +29,7 @@ import platform
 from threading import Event
 import json
 from ambari_commons import OSCheck
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
+from only_for_platform import not_for_platform, only_for_platform, get_platform, PLATFORM_LINUX,
PLATFORM_WINDOWS
 
 if get_platform() != PLATFORM_WINDOWS:
   os_distro_value = ('Suse','11','Final')
@@ -44,7 +44,7 @@ with patch.object(OSCheck, "os_distribution", new = MagicMock(return_value
= os_
   from ambari_agent.Hardware import Hardware
   import ambari_commons
 
-@only_for_platform(PLATFORM_LINUX)
+@not_for_platform(PLATFORM_WINDOWS)
 @patch.object(OSCheck, "os_distribution", new = os_distro_value)
 class TestController(unittest.TestCase):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b681b55a/ambari-agent/src/test/python/unitTests.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/unitTests.py b/ambari-agent/src/test/python/unitTests.py
index 0fd6b49..cb7a64f 100644
--- a/ambari-agent/src/test/python/unitTests.py
+++ b/ambari-agent/src/test/python/unitTests.py
@@ -106,7 +106,7 @@ def main():
       exit(1)
   else:
     logger.info('------------------------------------------------------------------------')
-    logger.info('Python unit tests finished succesfully')
+    logger.info('Python unit tests finished successfully')
     logger.info('------------------------------------------------------------------------')
 
 if __name__ == '__main__':

http://git-wip-us.apache.org/repos/asf/ambari/blob/b681b55a/ambari-common/src/main/python/ambari_commons/os_check.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/os_check.py b/ambari-common/src/main/python/ambari_commons/os_check.py
index 4e93feb..5d3dad3 100644
--- a/ambari-common/src/main/python/ambari_commons/os_check.py
+++ b/ambari-common/src/main/python/ambari_commons/os_check.py
@@ -163,6 +163,10 @@ class OSCheck:
         distribution = platform.dist()
       else:
         distribution = platform.linux_distribution()
+
+    if distribution[0] == '' and platform.system().lower() == 'darwin':
+      # mac - used for unit tests
+      distribution = ("Darwin", "TestOnly", "1.1.1", "1.1.1", "1.1")
     
     return distribution
 
@@ -188,6 +192,8 @@ class OSCheck:
       return 'sles'
     elif operatingSystem.startswith('red hat enterprise linux'):
       return 'redhat'
+    elif operatingSystem.startswith('darwin'):
+      return 'mac'
 
     if operatingSystem != '':
       return operatingSystem


Mime
View raw message