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-12036 Windows unit tests: Agent unit tests: fix the imports & failing patches
Date Tue, 21 Jul 2015 16:42:14 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 99cac719d -> 4e2b2d848


AMBARI-12036 Windows unit tests: Agent unit tests: fix the imports & failing patches

Excluded the inapplicable tests for now. 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/4e2b2d84
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4e2b2d84
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4e2b2d84

Branch: refs/heads/trunk
Commit: 4e2b2d8481260f1d2c06c2251b97a4105e987be7
Parents: 99cac71
Author: Florian Barca <fbarca@hortonworks.com>
Authored: Tue Jul 21 09:35:04 2015 -0700
Committer: Florian Barca <fbarca@hortonworks.com>
Committed: Tue Jul 21 09:40:52 2015 -0700

----------------------------------------------------------------------
 .../test/python/ambari_agent/TestActionQueue.py | 24 +++---
 .../ambari_agent/TestActualConfigHandler.py     |  7 +-
 .../python/ambari_agent/TestCertGeneration.py   | 12 +--
 .../test/python/ambari_agent/TestController.py  |  6 +-
 .../TestCustomServiceOrchestrator.py            | 25 +++---
 .../test/python/ambari_agent/TestDataCleaner.py |  9 +--
 .../test/python/ambari_agent/TestFileCache.py   |  4 +-
 .../test/python/ambari_agent/TestHostInfo.py    |  4 +-
 .../test/python/ambari_agent/TestHostname.py    | 11 +--
 .../test/python/ambari_agent/TestLiveStatus.py  |  7 +-
 .../src/test/python/ambari_agent/TestMain.py    | 55 ++++++-------
 .../src/test/python/ambari_agent/TestNetUtil.py |  9 +--
 .../python/ambari_agent/TestPythonExecutor.py   | 11 +--
 .../test/python/ambari_agent/TestSecurity.py    |  7 +-
 .../test/python/ambari_agent/TestStatusCheck.py |  7 +-
 .../resource_management/TestContentSources.py   |  5 +-
 .../TestDirectoryResource.py                    | 65 ++++++++--------
 .../resource_management/TestExecuteResource.py  | 13 ++--
 .../resource_management/TestFileResource.py     | 81 ++++++++++----------
 .../resource_management/TestGroupResource.py    | 20 +++--
 .../resource_management/TestLinkResource.py     | 36 ++++-----
 .../TestPropertiesFileResource.py               | 36 +++++----
 .../TestRepositoryResource.py                   | 10 ++-
 .../resource_management/TestUserResource.py     | 32 ++++----
 .../TestXmlConfigResource.py                    | 32 ++++----
 .../src/test/python/only_for_platform.py        |  5 ++
 26 files changed, 256 insertions(+), 277 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/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 4e130f9..5a22843 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
@@ -36,14 +36,9 @@ from ambari_agent.PythonExecutor import PythonExecutor
 from ambari_agent.CommandStatusDict import CommandStatusDict
 from ambari_agent.ActualConfigHandler import ActualConfigHandler
 from ambari_agent.RecoveryManager import RecoveryManager
-from FileCache import FileCache
+from ambari_agent.FileCache import FileCache
 from ambari_commons import OSCheck
-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')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import not_for_platform, os_distro_value, PLATFORM_WINDOWS
 
 class TestActionQueue(TestCase):
   def setUp(self):
@@ -818,9 +813,12 @@ class TestActionQueue(TestCase):
     self.assertEqual(2, sleep_mock.call_count)
     sleep_mock.assert_has_calls([call(2), call(3)], False)
     runCommand_mock.assert_has_calls([
-      call(command, '/tmp/ambari-agent/output-19.txt', '/tmp/ambari-agent/errors-19.txt', override_output_files=True, retry=False),
-      call(command, '/tmp/ambari-agent/output-19.txt', '/tmp/ambari-agent/errors-19.txt', override_output_files=False, retry=True),
-      call(command, '/tmp/ambari-agent/output-19.txt', '/tmp/ambari-agent/errors-19.txt', override_output_files=False, retry=True)])
+      call(command, os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'output-19.txt',
+           os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'errors-19.txt', override_output_files=True, retry=False),
+      call(command, os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'output-19.txt',
+           os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'errors-19.txt', override_output_files=False, retry=True),
+      call(command, os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'output-19.txt',
+           os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'errors-19.txt', override_output_files=False, retry=True)])
 
 
   @patch("time.time")
@@ -857,8 +855,10 @@ class TestActionQueue(TestCase):
     self.assertEqual(1, sleep_mock.call_count)
     sleep_mock.assert_has_calls([call(2)], False)
     runCommand_mock.assert_has_calls([
-      call(command, '/tmp/ambari-agent/output-19.txt', '/tmp/ambari-agent/errors-19.txt', override_output_files=True, retry=False),
-      call(command, '/tmp/ambari-agent/output-19.txt', '/tmp/ambari-agent/errors-19.txt', override_output_files=False, retry=True)])
+      call(command, os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'output-19.txt',
+           os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'errors-19.txt', override_output_files=True, retry=False),
+      call(command, os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'output-19.txt',
+           os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'errors-19.txt', override_output_files=False, retry=True)])
 
   #retryable_command
   @patch("time.sleep")

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestActualConfigHandler.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestActualConfigHandler.py b/ambari-agent/src/test/python/ambari_agent/TestActualConfigHandler.py
index 7f88e17..096516b 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestActualConfigHandler.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestActualConfigHandler.py
@@ -24,12 +24,7 @@ import logging
 from mock.mock import patch, MagicMock, call
 from ambari_agent.LiveStatus import LiveStatus
 from ambari_commons import OSCheck
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
-
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import os_distro_value
 
 with patch("platform.linux_distribution", return_value = ('Suse','11','Final')):
   from ambari_agent.AmbariConfig import AmbariConfig

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestCertGeneration.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestCertGeneration.py b/ambari-agent/src/test/python/ambari_agent/TestCertGeneration.py
index d188dbd..2461281 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCertGeneration.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCertGeneration.py
@@ -21,18 +21,12 @@ import os
 import tempfile
 import shutil
 from unittest import TestCase
-import ConfigParser
-import security
-from security import CertificateManager
+
+from ambari_agent.security import CertificateManager
 from ambari_agent import AmbariConfig
 from mock.mock import patch, MagicMock
 from ambari_commons import OSCheck
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
-
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import os_distro_value
 
 class TestCertGeneration(TestCase):
   @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/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 93a39c3..a18d159 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestController.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestController.py
@@ -31,7 +31,7 @@ import platform
 from threading import Event
 import ambari_simplejson
 from ambari_commons import OSCheck
-from only_for_platform import not_for_platform, only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
+from only_for_platform import not_for_platform, os_distro_value, PLATFORM_WINDOWS
 from ambari_agent import Controller, ActionQueue, Register
 from ambari_agent import hostname
 from ambari_agent.Controller import AGENT_AUTO_RESTART_EXIT_CODE
@@ -42,10 +42,8 @@ from ambari_agent.AmbariConfig import AmbariConfig
 from ambari_agent.Facter import FacterLinux
 import ambari_commons
 
-OPERATING_SYSTEM_DISTRO = ('Suse','11','Final')
-
 @not_for_platform(PLATFORM_WINDOWS)
-@patch.object(OSCheck, "os_distribution", new = OPERATING_SYSTEM_DISTRO)
+@patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
 class TestController(unittest.TestCase):
 
   logger = logging.getLogger()

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
index 831ecce..8957b44 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
@@ -30,24 +30,19 @@ import tempfile
 import time
 from threading import Thread
 
-from PythonExecutor import PythonExecutor
-from CustomServiceOrchestrator import CustomServiceOrchestrator
-from AmbariConfig import AmbariConfig
 from mock.mock import MagicMock, patch
 import StringIO
 import sys
-from AgentException import AgentException
-from FileCache import FileCache
-from LiveStatus import LiveStatus
-from BackgroundCommandExecutionHandle import BackgroundCommandExecutionHandle
+
 from ambari_agent.ActionQueue import ActionQueue
+from ambari_agent.AgentException import AgentException
+from ambari_agent.AmbariConfig import AmbariConfig
+from ambari_agent.BackgroundCommandExecutionHandle import BackgroundCommandExecutionHandle
+from ambari_agent.CustomServiceOrchestrator import CustomServiceOrchestrator
+from ambari_agent.FileCache import FileCache
+from ambari_agent.PythonExecutor import PythonExecutor
 from ambari_commons import OSCheck
-from only_for_platform import get_platform, PLATFORM_WINDOWS
-
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import get_platform, os_distro_value, PLATFORM_WINDOWS
 
 class TestCustomServiceOrchestrator(TestCase):
 
@@ -81,7 +76,7 @@ class TestCustomServiceOrchestrator(TestCase):
 
   @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
   @patch.object(CustomServiceOrchestrator, 'decompressClusterHostInfo')
-  @patch("hostname.public_hostname")
+  @patch("ambari_agent.hostname.public_hostname")
   @patch("os.path.isfile")
   @patch("os.unlink")
   @patch.object(FileCache, "__init__")
@@ -144,7 +139,7 @@ class TestCustomServiceOrchestrator(TestCase):
 
 
   @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
-  @patch("hostname.public_hostname")
+  @patch("ambari_agent.hostname.public_hostname")
   @patch("os.path.isfile")
   @patch("os.unlink")
   @patch.object(FileCache, "__init__")

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestDataCleaner.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestDataCleaner.py b/ambari-agent/src/test/python/ambari_agent/TestDataCleaner.py
index 3ecb46a..02b69ac 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestDataCleaner.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestDataCleaner.py
@@ -22,15 +22,10 @@ limitations under the License.
 import unittest
 from mock.mock import patch, MagicMock, call, Mock
 from ambari_agent import DataCleaner
-import AmbariConfig
+from ambari_agent import AmbariConfig
 import os
 from ambari_commons import OSCheck
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
-
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import os_distro_value
 
 class TestDataCleaner(unittest.TestCase):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestFileCache.py b/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
index da08782..1ffcadc 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
@@ -28,8 +28,8 @@ import tempfile
 import time
 from threading import Thread
 
-from FileCache import FileCache, CachingException
-from AmbariConfig import AmbariConfig
+from ambari_agent.FileCache import FileCache, CachingException
+from ambari_agent.AmbariConfig import AmbariConfig
 from mock.mock import MagicMock, patch
 import StringIO
 import sys

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py b/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
index 58745f9..57e4224 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestHostInfo.py
@@ -31,7 +31,7 @@ from mock.mock import create_autospec
 import ambari_commons
 from ambari_commons import OSCheck
 import os
-from only_for_platform import not_for_platform, get_platform, PLATFORM_WINDOWS, PLATFORM_LINUX
+from only_for_platform import not_for_platform, os_distro_value, PLATFORM_WINDOWS
 from ambari_commons.firewall import Firewall
 from ambari_commons.os_check import OSCheck, OSConst
 from ambari_agent.HostCheckReportFileHandler import HostCheckReportFileHandler
@@ -42,7 +42,7 @@ from resource_management.core.system import System
 from resource_management.libraries.functions import packages_analyzer
 
 @not_for_platform(PLATFORM_WINDOWS)
-@patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = ('Suse','11','Final')))
+@patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
 class TestHostInfo(TestCase):
 
   @patch.object(OSCheck, 'get_os_family')

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestHostname.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestHostname.py b/ambari-agent/src/test/python/ambari_agent/TestHostname.py
index 8cfcc96..3cf6b17 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestHostname.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestHostname.py
@@ -28,12 +28,7 @@ import shutil
 import os, pprint, json,stat
 from mock.mock import patch, MagicMock
 from ambari_commons import OSCheck
-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')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import not_for_platform, os_distro_value, PLATFORM_WINDOWS
 
 class TestHostname(TestCase):
 
@@ -78,7 +73,7 @@ class TestHostname(TestCase):
       config.remove_option('server', 'hostname_script')
     pass
 
-  @only_for_platform(PLATFORM_LINUX)
+  @not_for_platform(PLATFORM_WINDOWS)
   def test_hostname_override(self):
     hostname.cached_hostname = None
     hostname.cached_public_hostname = None
@@ -101,7 +96,7 @@ class TestHostname(TestCase):
       config.remove_option('agent', 'hostname_script')
     pass
 
-  @only_for_platform(PLATFORM_LINUX)
+  @not_for_platform(PLATFORM_WINDOWS)
   def test_public_hostname_override(self):
     hostname.cached_hostname = None
     hostname.cached_public_hostname = None

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestLiveStatus.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestLiveStatus.py b/ambari-agent/src/test/python/ambari_agent/TestLiveStatus.py
index e9bb776..871dfb7 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestLiveStatus.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestLiveStatus.py
@@ -27,12 +27,7 @@ from mock.mock import patch, MagicMock
 import pprint
 from ambari_agent import StatusCheck
 from ambari_commons import OSCheck
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
-
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import os_distro_value
 
 
 class TestLiveStatus(TestCase):

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestMain.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestMain.py b/ambari-agent/src/test/python/ambari_agent/TestMain.py
index 8c8d347..7a3dc71 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestMain.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestMain.py
@@ -28,14 +28,9 @@ import tempfile
 import ConfigParser
 
 from ambari_commons import OSCheck
-from only_for_platform import get_platform, not_for_platform, only_for_platform, PLATFORM_WINDOWS, PLATFORM_LINUX
+from only_for_platform import get_platform, not_for_platform, os_distro_value, PLATFORM_WINDOWS
 from mock.mock import MagicMock, patch, ANY, Mock
 
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
-
 with patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value)):
   from ambari_agent import NetUtil, security
   from ambari_agent import ProcessHelper, main
@@ -46,8 +41,6 @@ with patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_
   import ambari_agent.HeartbeatHandlers as HeartbeatHandlers
   from ambari_commons.os_check import OSConst, OSCheck
   from ambari_agent.ExitHelper import ExitHelper
-  if get_platform() != PLATFORM_WINDOWS:
-    from ambari_commons.shell import shellRunnerLinux
 
 class TestMain(unittest.TestCase):
 
@@ -61,7 +54,7 @@ class TestMain(unittest.TestCase):
     # enable stdout
     sys.stdout = sys.__stdout__
 
-  @only_for_platform(PLATFORM_LINUX)
+  @not_for_platform(PLATFORM_WINDOWS)
   @patch("ambari_agent.HeartbeatHandlers.HeartbeatStopHandlersLinux")
   @patch("sys.exit")
   @patch("os.getpid")
@@ -130,7 +123,7 @@ class TestMain(unittest.TestCase):
     main.update_log_level(config)
     setLevel_mock.assert_called_with(logging.INFO)
 
-  @only_for_platform(PLATFORM_LINUX)
+  @not_for_platform(PLATFORM_WINDOWS)
   @patch("signal.signal")
   def test_bind_signal_handlers(self, signal_mock):
     main.bind_signal_handlers(os.getpid())
@@ -206,10 +199,11 @@ class TestMain(unittest.TestCase):
   @not_for_platform(PLATFORM_WINDOWS)
   @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
   @patch("time.sleep")
-  @patch.object(shellRunnerLinux,"run")
   @patch("sys.exit")
   @patch("os.path.exists")
-  def test_daemonize_and_stop(self, exists_mock, sys_exit_mock, kill_mock, sleep_mock):
+  def test_daemonize_and_stop(self, exists_mock, sys_exit_mock, sleep_mock):
+    from ambari_commons.shell import shellRunnerLinux
+
     oldpid = ProcessHelper.pidfile
     pid = str(os.getpid())
     _, tmpoutfile = tempfile.mkstemp()
@@ -220,24 +214,25 @@ class TestMain(unittest.TestCase):
     saved = open(ProcessHelper.pidfile, 'r').read()
     self.assertEqual(pid, saved)
 
-    # Reuse pid file when testing agent stop
-    # Testing normal exit
-    exists_mock.return_value = False
-    main.stop_agent()
-    kill_mock.assert_called_with(['ambari-sudo.sh', 'kill', '-15', pid])
-    sys_exit_mock.assert_called_with(0)
-
-    # Restore
-    kill_mock.reset_mock()
-    sys_exit_mock.reset_mock()
-    kill_mock.return_value = {'exitCode': 0, 'output': 'out', 'error': 'err'}
-
-    # Testing exit when failed to remove pid file
-    exists_mock.return_value = True
-    main.stop_agent()
-    kill_mock.assert_any_call(['ambari-sudo.sh', 'kill', '-15', pid])
-    kill_mock.assert_any_call(['ambari-sudo.sh', 'kill', '-9', pid])
-    sys_exit_mock.assert_called_with(1)
+    with patch("ambari_commons.shell.shellRunnerLinux.run") as kill_mock:
+      # Reuse pid file when testing agent stop
+      # Testing normal exit
+      exists_mock.return_value = False
+      main.stop_agent()
+      kill_mock.assert_called_with(['ambari-sudo.sh', 'kill', '-15', pid])
+      sys_exit_mock.assert_called_with(0)
+
+      # Restore
+      kill_mock.reset_mock()
+      sys_exit_mock.reset_mock()
+      kill_mock.return_value = {'exitCode': 0, 'output': 'out', 'error': 'err'}
+
+      # Testing exit when failed to remove pid file
+      exists_mock.return_value = True
+      main.stop_agent()
+      kill_mock.assert_any_call(['ambari-sudo.sh', 'kill', '-15', pid])
+      kill_mock.assert_any_call(['ambari-sudo.sh', 'kill', '-9', pid])
+      sys_exit_mock.assert_called_with(1)
 
     # Restore
     ProcessHelper.pidfile = oldpid

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestNetUtil.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestNetUtil.py b/ambari-agent/src/test/python/ambari_agent/TestNetUtil.py
index 3d8083b..ec4818e 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestNetUtil.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestNetUtil.py
@@ -23,12 +23,7 @@ from mock.mock import MagicMock, patch
 import unittest
 import threading
 from ambari_commons import OSCheck
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
-
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import not_for_platform, os_distro_value, PLATFORM_WINDOWS
 
 class TestNetUtil(unittest.TestCase):
 
@@ -58,7 +53,7 @@ class TestNetUtil(unittest.TestCase):
     httpsConMock.side_effect = Exception("test")
     self.assertFalse(netutil.checkURL("url")[0])
 
-  @only_for_platform(PLATFORM_LINUX)
+  @not_for_platform(PLATFORM_WINDOWS)
   @patch("time.sleep")
   @patch.object(threading._Event, "wait")
   def test_try_to_connect(self, event_mock,

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestPythonExecutor.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestPythonExecutor.py b/ambari-agent/src/test/python/ambari_agent/TestPythonExecutor.py
index eb6dd29..e4a47d1 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestPythonExecutor.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestPythonExecutor.py
@@ -26,16 +26,11 @@ import tempfile
 import time
 from threading import Thread
 
-from PythonExecutor import PythonExecutor
-from AmbariConfig import AmbariConfig
+from ambari_agent.PythonExecutor import PythonExecutor
+from ambari_agent.AmbariConfig import AmbariConfig
 from mock.mock import MagicMock, patch
 from ambari_commons import OSCheck
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
-
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import os_distro_value
 
 @patch.object(PythonExecutor, "open_subprocess_files", new=MagicMock(return_value =("", "")))
 class TestPythonExecutor(TestCase):

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestSecurity.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestSecurity.py b/ambari-agent/src/test/python/ambari_agent/TestSecurity.py
index c47172a..0e1e4ee 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestSecurity.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestSecurity.py
@@ -30,12 +30,7 @@ import os
 import tempfile
 
 from ambari_commons import OSCheck
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
-
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import os_distro_value
 
 with patch("platform.linux_distribution", return_value = ('Suse','11','Final')):
   from ambari_agent import NetUtil

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/ambari_agent/TestStatusCheck.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestStatusCheck.py b/ambari-agent/src/test/python/ambari_agent/TestStatusCheck.py
index 32be4a8..34c57cc 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestStatusCheck.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestStatusCheck.py
@@ -28,12 +28,7 @@ import logging
 from mock.mock import patch
 from mock.mock import MagicMock
 
-from only_for_platform import only_for_platform, get_platform, PLATFORM_LINUX, PLATFORM_WINDOWS
-
-if get_platform() != PLATFORM_WINDOWS:
-  os_distro_value = ('Suse','11','Final')
-else:
-  os_distro_value = ('win2012serverr2','6.3','WindowsServer')
+from only_for_platform import os_distro_value
 
 USERNAME_LENGTH=10
 USERNAME_CHARS=string.ascii_uppercase +string.ascii_lowercase + string.digits + '-_'

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestContentSources.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestContentSources.py b/ambari-agent/src/test/python/resource_management/TestContentSources.py
index c144cf9..55c3300 100644
--- a/ambari-agent/src/test/python/resource_management/TestContentSources.py
+++ b/ambari-agent/src/test/python/resource_management/TestContentSources.py
@@ -18,6 +18,7 @@ limitations under the License.
 
 from unittest import TestCase
 from mock.mock import patch, MagicMock
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
 
 from resource_management.core import Environment
 from resource_management.core.system import System
@@ -25,7 +26,9 @@ from resource_management.core.source import StaticFile
 from resource_management.core.source import DownloadSource
 from resource_management.core.source import Template
 from resource_management.core.source import InlineTemplate
-from resource_management.core import sudo
+
+if get_platform() != PLATFORM_WINDOWS:
+  from resource_management.core import sudo
 
 from ambari_jinja2 import UndefinedError, TemplateNotFound
 import urllib2

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestDirectoryResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestDirectoryResource.py b/ambari-agent/src/test/python/resource_management/TestDirectoryResource.py
index e57ed67..f1ca4de 100644
--- a/ambari-agent/src/test/python/resource_management/TestDirectoryResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestDirectoryResource.py
@@ -18,24 +18,29 @@ limitations under the License.
 
 from unittest import TestCase
 from mock.mock import patch, MagicMock
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
+
 import os
 from resource_management.core.system import System
-from resource_management.core import Environment, Fail, sudo
+from resource_management.core import Environment, Fail
 from resource_management.core.resources import Directory
-import pwd
-import grp
+
+if get_platform() != PLATFORM_WINDOWS:
+  import pwd
+  import grp
+
 
 @patch.object(System, "os_family", new = 'redhat')
 class TestDirectoryResource(TestCase):
   
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "makedirs")
-  @patch.object(sudo, "path_isdir")
-  @patch.object(sudo, "stat")
-  @patch.object(sudo,"chmod")
-  @patch.object(sudo,"chown")
-  @patch.object(pwd, "getpwnam")
-  @patch.object(grp, "getgrnam")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.makedirs")
+  @patch("resource_management.core.sudo.path_isdir")
+  @patch("resource_management.core.sudo.stat")
+  @patch("resource_management.core.sudo.chmod")
+  @patch("resource_management.core.sudo.chown")
+  @patch("pwd.getpwnam")
+  @patch("grp.getgrnam")
   def test_create_directory_recursive(self, getgrnam_mock, getpwnam_mock,
                                       os_chown_mock, os_chmod_mock, os_stat_mock,
                                       isdir_mock, os_makedirs_mock, 
@@ -62,15 +67,15 @@ class TestDirectoryResource(TestCase):
     os_chmod_mock.assert_called_with('/a/b/c/d', 0777)
     os_chown_mock.assert_any_call('/a/b/c/d', getpwnam_mock.return_value, getgrnam_mock.return_value)
   
-  @patch.object(sudo, "path_exists")
+  @patch("resource_management.core.sudo.path_exists")
   @patch.object(os.path, "dirname")
-  @patch.object(sudo, "path_isdir")
-  @patch.object(sudo, "makedir")
-  @patch.object(sudo, "stat")
-  @patch.object(sudo,"chmod")
-  @patch.object(sudo,"chown")
-  @patch.object(pwd, "getpwnam")
-  @patch.object(grp, "getgrnam")
+  @patch("resource_management.core.sudo.path_isdir")
+  @patch("resource_management.core.sudo.makedir")
+  @patch("resource_management.core.sudo.stat")
+  @patch("resource_management.core.sudo.chmod")
+  @patch("resource_management.core.sudo.chown")
+  @patch("pwd.getpwnam")
+  @patch("grp.getgrnam")
   def test_create_directory_not_recursive(self, getgrnam_mock, getpwnam_mock,
                                       os_chown_mock, os_chmod_mock, os_stat_mock,
                                       mkdir_mock, isdir_mock, os_dirname_mock, 
@@ -96,9 +101,9 @@ class TestDirectoryResource(TestCase):
     os_chmod_mock.assert_called_with('/a/b/c/d', 0777)
     os_chown_mock.assert_any_call('/a/b/c/d', getpwnam_mock.return_value, getgrnam_mock.return_value)
     
-  @patch.object(sudo, "path_exists")
+  @patch("resource_management.core.sudo.path_exists")
   @patch.object(os.path, "dirname")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_create_directory_failed_no_parent(self, isdir_mock, os_dirname_mock, 
                                       os_path_exists_mock):
     os_path_exists_mock.return_value = False
@@ -119,8 +124,8 @@ class TestDirectoryResource(TestCase):
       self.assertEqual('Applying Directory[\'/a/b/c/d\'] failed, parent directory /a/b/c doesn\'t exist',
                        str(e))
 
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_create_directory_path_is_file_or_line(self, isdir_mock, os_path_exists_mock):
     os_path_exists_mock.return_value = True
     isdir_mock.return_value = False
@@ -138,9 +143,9 @@ class TestDirectoryResource(TestCase):
       self.assertEqual('Applying Directory[\'/a/b/c/d\'] failed, file /a/b/c/d already exists',
                        str(e))
   
-  @patch.object(sudo, "rmtree")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.rmtree")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_delete_directory(self, isdir_mock, os_path_exists_mock, rmtree_mock):
     os_path_exists_mock.return_value = True
     isdir_mock.return_value = True
@@ -152,7 +157,7 @@ class TestDirectoryResource(TestCase):
       
     rmtree_mock.assert_called_with('/a/b/c/d')
     
-  @patch.object(sudo, "path_exists")
+  @patch("resource_management.core.sudo.path_exists")
   def test_delete_noexisting_directory(self, os_path_exists_mock):
     os_path_exists_mock.return_value = False
     
@@ -161,9 +166,9 @@ class TestDirectoryResource(TestCase):
            action='delete'
       )
   
-  @patch.object(sudo, "rmtree")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.rmtree")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_delete_directory_with_path_to_file(self, isdir_mock, os_path_exists_mock, rmtree_mock):
     os_path_exists_mock.return_value = True
     isdir_mock.return_value = False

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestExecuteResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestExecuteResource.py b/ambari-agent/src/test/python/resource_management/TestExecuteResource.py
index 04244e9..2a6cd9b 100644
--- a/ambari-agent/src/test/python/resource_management/TestExecuteResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestExecuteResource.py
@@ -18,18 +18,21 @@ limitations under the License.
 
 from unittest import TestCase
 from mock.mock import patch, MagicMock, call
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
 
 from resource_management.core.system import System
 from resource_management.core.resources.system import Execute
 from resource_management.core.environment import Environment
-from resource_management.core import sudo
 
 import subprocess
 import logging
 import os
 from resource_management import Fail
-import grp
-import pwd
+
+if get_platform() != PLATFORM_WINDOWS:
+  import grp
+  import pwd
+
 import select
 
 
@@ -69,7 +72,7 @@ class TestExecuteResource(TestCase):
     self.assertTrue(popen_mock.called, 'subprocess.Popen should have been called!')
     self.assertFalse(proc_communicate_mock.called, 'proc.communicate should not have been called!')
 
-  @patch.object(sudo, "path_exists")
+  @patch("resource_management.core.sudo.path_exists")
   @patch.object(subprocess, "Popen")
   def test_attribute_creates(self, popen_mock, exists_mock):
     exists_mock.return_value = True
@@ -133,7 +136,7 @@ class TestExecuteResource(TestCase):
 
     self.assertTrue(call(10) in time_mock.call_args_list)
 
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_attribute_group(self, getpwnam_mock):
     def error(argument):
       self.assertEqual(argument, "test_user")

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestFileResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestFileResource.py b/ambari-agent/src/test/python/resource_management/TestFileResource.py
index 43df94f..7774108 100644
--- a/ambari-agent/src/test/python/resource_management/TestFileResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestFileResource.py
@@ -19,22 +19,25 @@ limitations under the License.
 
 from unittest import TestCase
 from mock.mock import patch, MagicMock
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
+
 import os
 import sys
-import grp
-import pwd
 from resource_management.core import Environment, Fail
 from resource_management.core.resources import File
 from resource_management.core.system import System
-from resource_management.core import sudo
-import resource_management.core.providers.system
 import resource_management
 
+if get_platform() != PLATFORM_WINDOWS:
+  import resource_management.core.providers.system
+  import grp
+  import pwd
+
 
 @patch.object(System, "os_family", new = 'redhat')
 class TestFileResource(TestCase):
   @patch.object(os.path, "dirname")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_action_create_dir_exist(self, isdir_mock, dirname_mock):
     """
     Tests if 'create' action fails when path is existent directory
@@ -55,7 +58,7 @@ class TestFileResource(TestCase):
     self.assertFalse(dirname_mock.called)
 
   @patch.object(os.path, "dirname")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_action_create_parent_dir_non_exist(self, isdir_mock, dirname_mock):
     """
     Tests if 'create' action fails when parent directory of path
@@ -79,10 +82,10 @@ class TestFileResource(TestCase):
     self.assertTrue(dirname_mock.called)
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "read_file")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.read_file")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_action_create_non_existent_file(self, isdir_mock, exists_mock, create_file_mock, read_file_mock, ensure_mock):
     """
     Tests if 'create' action create new non existent file and write proper data
@@ -103,10 +106,10 @@ class TestFileResource(TestCase):
 
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "read_file")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.read_file")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_action_create_replace(self, isdir_mock, exists_mock, create_file_mock, read_file_mock, ensure_mock):
     """
     Tests if 'create' action rewrite existent file with new data
@@ -126,9 +129,9 @@ class TestFileResource(TestCase):
     create_file_mock.assert_called_with('/directory/file', 'new-content', encoding=None)
 
 
-  @patch.object(sudo, "unlink")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.unlink")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_action_delete_is_directory(self, isdir_mock, exist_mock, unlink_mock):
     """
     Tests if 'delete' action fails when path is directory
@@ -152,9 +155,9 @@ class TestFileResource(TestCase):
     self.assertEqual(exist_mock.call_count, 0)
     self.assertEqual(unlink_mock.call_count, 0)
 
-  @patch.object(sudo, "unlink")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.unlink")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_action_delete(self, isdir_mock, exist_mock, unlink_mock):
     """
     Tests if 'delete' action removes file
@@ -175,7 +178,7 @@ class TestFileResource(TestCase):
     self.assertEqual(unlink_mock.call_count, 1)
 
 
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_attribute_path(self, isdir_mock):
     """
     Tests 'path' attribute
@@ -198,10 +201,10 @@ class TestFileResource(TestCase):
 
   @patch.object(resource_management.core.Environment, "backup_file")
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "read_file")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.read_file")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_attribute_backup(self, isdir_mock, exists_mock, create_file_mock,  read_file_mock, ensure_mock, backup_file_mock):
     """
     Tests 'backup' attribute
@@ -235,8 +238,8 @@ class TestFileResource(TestCase):
 
   @patch("resource_management.core.providers.system._ensure_metadata")
   @patch("__builtin__.open")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_attribute_replace(self, isdir_mock, exists_mock, open_mock, ensure_mock):
     """
     Tests 'replace' attribute
@@ -263,14 +266,14 @@ class TestFileResource(TestCase):
     self.assertEqual(open_mock.call_count, 0)
 
 
-  @patch.object(pwd, "getpwnam")
-  @patch.object(grp, "getgrnam")
-  @patch.object(sudo, "chown")
-  @patch.object(sudo, "chmod")
-  @patch.object(sudo, "stat")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("pwd.getpwnam")
+  @patch("grp.getgrnam")
+  @patch("resource_management.core.sudo.chown")
+  @patch("resource_management.core.sudo.chmod")
+  @patch("resource_management.core.sudo.stat")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_ensure_metadata(self, isdir_mock, exists_mock, create_file_mock, stat_mock, chmod_mock, chown_mock, getgrnam_mock,
                            getpwnam_mock):
     """
@@ -331,10 +334,10 @@ class TestFileResource(TestCase):
 
   @patch("resource_management.core.providers.system._ensure_metadata")
   @patch("resource_management.core.providers.system.FileProvider._get_content")
-  @patch.object(sudo, "read_file")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.read_file")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_action_create_encoding(self, isdir_mock, exists_mock, create_file_mock, read_file_mock, get_content_mock ,ensure_mock):
 
     isdir_mock.side_effect = [False, True]

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestGroupResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestGroupResource.py b/ambari-agent/src/test/python/resource_management/TestGroupResource.py
index 1d52a90..da982cf 100644
--- a/ambari-agent/src/test/python/resource_management/TestGroupResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestGroupResource.py
@@ -18,16 +18,20 @@ limitations under the License.
 
 from unittest import TestCase
 from mock.mock import patch, MagicMock
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
+
 from resource_management.core import Environment, Fail
 from resource_management.core.resources import Group
 from resource_management.core.system import System
 
 import subprocess
-import grp
 import os
-import pty
 import select
 
+if get_platform() != PLATFORM_WINDOWS:
+  import grp
+  import pty
+
 
 subproc_stdout = MagicMock()
 
@@ -35,11 +39,11 @@ subproc_stdout = MagicMock()
 @patch.object(select, "select", new=MagicMock(return_value=([subproc_stdout], None, None)))
 @patch.object(System, "os_family", new = 'redhat')
 @patch.object(os, "environ", new = {'PATH':'/bin'})
-@patch.object(pty, "openpty", new = MagicMock(return_value=(1,5)))
+@patch("pty.openpty", new = MagicMock(return_value=(1,5)))
 @patch.object(os, "close", new=MagicMock())
 class TestGroupResource(TestCase):
 
-  @patch.object(grp, "getgrnam")
+  @patch("grp.getgrnam")
   @patch.object(subprocess, "Popen")
   def test_action_create_nonexistent(self, popen_mock, getgrnam_mock):
     subproc_mock = MagicMock()
@@ -60,7 +64,7 @@ class TestGroupResource(TestCase):
     getgrnam_mock.assert_called_with('hadoop')
 
 
-  @patch.object(grp, "getgrnam")
+  @patch("grp.getgrnam")
   @patch.object(subprocess, "Popen")
   def test_action_create_existent(self, popen_mock, getgrnam_mock):
     subproc_mock = MagicMock()
@@ -82,7 +86,7 @@ class TestGroupResource(TestCase):
     getgrnam_mock.assert_called_with('mapred')
 
 
-  @patch.object(grp, "getgrnam")
+  @patch("grp.getgrnam")
   @patch.object(subprocess, "Popen")
   def test_action_create_fail(self, popen_mock, getgrnam_mock):
     subproc_mock = MagicMock()
@@ -107,7 +111,7 @@ class TestGroupResource(TestCase):
     getgrnam_mock.assert_called_with('mapred')
 
 
-  @patch.object(grp, "getgrnam")
+  @patch("grp.getgrnam")
   @patch.object(subprocess, "Popen")
   def test_action_remove(self, popen_mock, getgrnam_mock):
 
@@ -128,7 +132,7 @@ class TestGroupResource(TestCase):
     getgrnam_mock.assert_called_with('mapred')
 
 
-  @patch.object(grp, "getgrnam")
+  @patch("grp.getgrnam")
   @patch.object(subprocess, "Popen")
   def test_action_remove_fail(self, popen_mock, getgrnam_mock):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestLinkResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestLinkResource.py b/ambari-agent/src/test/python/resource_management/TestLinkResource.py
index ceac076..f27b5d0 100644
--- a/ambari-agent/src/test/python/resource_management/TestLinkResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestLinkResource.py
@@ -18,9 +18,9 @@ limitations under the License.
 
 from unittest import TestCase
 from mock.mock import patch, MagicMock
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
 
 from resource_management.core import Environment, Fail
-from resource_management.core import sudo
 from resource_management.core.system import System
 from resource_management.core.resources.system import Link
 
@@ -30,10 +30,10 @@ import os
 class TestLinkResource(TestCase):
 
   @patch.object(os.path, "realpath")
-  @patch.object(sudo,  "path_lexists")
-  @patch.object(sudo,  "path_lexists")
-  @patch.object(sudo, "unlink")
-  @patch.object(sudo, "symlink")
+  @patch("resource_management.core.sudo.path_lexists")
+  @patch("resource_management.core.sudo.path_lexists")
+  @patch("resource_management.core.sudo.unlink")
+  @patch("resource_management.core.sudo.symlink")
   def test_action_create_relink(self, symlink_mock, unlink_mock, 
                          islink_mock, lexists_mock,
                          realmock):
@@ -49,7 +49,7 @@ class TestLinkResource(TestCase):
     symlink_mock.assert_called_with("/a/b/link_to_path", "/some_path")
     
   @patch.object(os.path, "realpath")
-  @patch.object(sudo,  "path_lexists")
+  @patch("resource_management.core.sudo.path_lexists")
   def test_action_create_failed_due_to_file_exists(self, 
                          lexists_mock, realmock):
     lexists_mock.side_effect = [True, False]
@@ -65,8 +65,8 @@ class TestLinkResource(TestCase):
         self.assertEqual("Link['/some_path'] trying to create a symlink with the same name as an existing file or directory",
                        str(e))
         
-  @patch.object(sudo,  "path_lexists")
-  @patch.object(sudo, "symlink")
+  @patch("resource_management.core.sudo.path_lexists")
+  @patch("resource_management.core.sudo.symlink")
   def test_action_create_symlink_clean_create(self, symlink_mock, lexists_mock):
     lexists_mock.return_value = False
     
@@ -78,9 +78,9 @@ class TestLinkResource(TestCase):
     symlink_mock.assert_called_with("/a/b/link_to_path", "/some_path")
     
   @patch.object(os.path, "isdir")
-  @patch.object(sudo, "path_exists")  
-  @patch.object(sudo,  "path_lexists")
-  @patch.object(sudo, "link")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_lexists")
+  @patch("resource_management.core.sudo.link")
   def test_action_create_hardlink_clean_create(self, link_mock, lexists_mock,
                                         exists_mock, isdir_mock):
     lexists_mock.return_value = False
@@ -95,8 +95,8 @@ class TestLinkResource(TestCase):
       
     link_mock.assert_called_with("/a/b/link_to_path", "/some_path")
     
-  @patch.object(sudo, "path_exists")  
-  @patch.object(sudo,  "path_lexists")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_lexists")
   def test_action_create_hardlink_target_doesnt_exist(self, lexists_mock,
                                         exists_mock):
     lexists_mock.return_value = False
@@ -113,9 +113,9 @@ class TestLinkResource(TestCase):
         self.assertEqual('Failed to apply Link[\'/some_path\'], linking to nonexistent location /a/b/link_to_path',
                        str(e))
         
-  @patch.object(sudo, "path_isdir") 
-  @patch.object(sudo, "path_exists")  
-  @patch.object(sudo,  "path_lexists")
+  @patch("resource_management.core.sudo.path_isdir")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_lexists")
   def test_action_create_hardlink_target_is_dir(self, lexists_mock,
                                         exists_mock, isdir_mock):
     lexists_mock.return_value = False
@@ -133,8 +133,8 @@ class TestLinkResource(TestCase):
         self.assertEqual('Failed to apply Link[\'/some_path\'], cannot create hard link to a directory (/a/b/link_to_path)',
                        str(e)) 
         
-  @patch.object(sudo, "unlink")
-  @patch.object(sudo, "path_exists")
+  @patch("resource_management.core.sudo.unlink")
+  @patch("resource_management.core.sudo.path_exists")
   def test_action_delete(self, exists_mock, unlink_mock):     
     exists_mock.return_value = True
     

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestPropertiesFileResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestPropertiesFileResource.py b/ambari-agent/src/test/python/resource_management/TestPropertiesFileResource.py
index 5c97380..7ca6ef8 100644
--- a/ambari-agent/src/test/python/resource_management/TestPropertiesFileResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestPropertiesFileResource.py
@@ -24,7 +24,9 @@ import os
 import time
 from unittest import TestCase
 from mock.mock import patch, MagicMock
-from resource_management.core import Environment, sudo
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
+
+from resource_management.core import Environment
 from resource_management.core.system import System
 from resource_management.libraries import PropertiesFile
 
@@ -37,9 +39,9 @@ class TestPropertiesFIleResource(TestCase):
 
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   @patch.object(time, "asctime")
   def test_action_create_empty_properties_without_dir(self,
                                                       time_asctime_mock,
@@ -70,9 +72,9 @@ class TestPropertiesFIleResource(TestCase):
 
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   @patch.object(time, "asctime")
   def test_action_create_empty_properties_with_dir(self,
                                                    time_asctime_mock,
@@ -103,9 +105,9 @@ class TestPropertiesFIleResource(TestCase):
 
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   @patch.object(time, "asctime")
   def test_action_create_properties_simple(self,
                                            time_asctime_mock,
@@ -136,9 +138,9 @@ class TestPropertiesFIleResource(TestCase):
 
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   @patch.object(time, "asctime")
   def test_action_create_properties_with_metacharacters(self,
                                                         time_asctime_mock,
@@ -174,10 +176,10 @@ class TestPropertiesFIleResource(TestCase):
 
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "read_file")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.read_file")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   @patch.object(time, "asctime")
   def test_action_create_properties_rewrite_content(self,
                                                     time_asctime_mock,

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py b/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
index 0f30178..8ff0fd2 100644
--- a/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestRepositoryResource.py
@@ -20,11 +20,17 @@ import os, sys
 import tempfile
 from unittest import TestCase
 from mock.mock import patch, MagicMock
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
 
-from resource_management import *
-from resource_management.libraries.providers import repository
+from resource_management.core.environment import Environment
+from resource_management.core.source import InlineTemplate
+from resource_management.core.system import System
+from resource_management.libraries.resources.repository import Repository
 from ambari_commons.os_check import OSCheck
 
+if get_platform() != PLATFORM_WINDOWS:
+  from resource_management.libraries.providers import repository
+
 class DummyTemplate(object):
 
   def __init__(self, name, extra_imports=[], **kwargs):

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestUserResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestUserResource.py b/ambari-agent/src/test/python/resource_management/TestUserResource.py
index 1598823..f2c25fa 100644
--- a/ambari-agent/src/test/python/resource_management/TestUserResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestUserResource.py
@@ -18,28 +18,32 @@ limitations under the License.
 
 from unittest import TestCase
 from mock.mock import patch, MagicMock, PropertyMock
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
 
 from resource_management.core import Environment, Fail
 from resource_management.core.system import System
 from resource_management.core.resources import User
-import pwd
 import subprocess
 import os
-import pty
 import select
 
+if get_platform() != PLATFORM_WINDOWS:
+  import pwd
+  import pty
+
+
 subproc_stdout = MagicMock()
 
 @patch.object(os, "read", new=MagicMock(return_value=None))
 @patch.object(select, "select", new=MagicMock(return_value=([subproc_stdout], None, None)))
 @patch.object(System, "os_family", new = 'redhat')
 @patch.object(os, "environ", new = {'PATH':'/bin'})
-@patch.object(pty, "openpty", new = MagicMock(return_value=(1,5)))
+@patch("pty.openpty", new = MagicMock(return_value=(1,5)))
 @patch.object(os, "close", new=MagicMock())
 class TestUserResource(TestCase):
 
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_action_create_nonexistent(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -53,7 +57,7 @@ class TestUserResource(TestCase):
     self.assertEqual(popen_mock.call_count, 1)
     
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_action_create_existent(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -68,7 +72,7 @@ class TestUserResource(TestCase):
     self.assertEqual(popen_mock.call_count, 1)
 
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_action_delete(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -83,7 +87,7 @@ class TestUserResource(TestCase):
     self.assertEqual(popen_mock.call_count, 1)
 
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_attribute_comment(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -99,7 +103,7 @@ class TestUserResource(TestCase):
     self.assertEqual(popen_mock.call_count, 1)
 
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_attribute_home(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -115,7 +119,7 @@ class TestUserResource(TestCase):
     self.assertEqual(popen_mock.call_count, 1)
 
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_attribute_password(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -131,7 +135,7 @@ class TestUserResource(TestCase):
     self.assertEqual(popen_mock.call_count, 1)
 
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_attribute_shell(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -146,7 +150,7 @@ class TestUserResource(TestCase):
     self.assertEqual(popen_mock.call_count, 1)
 
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_attribute_uid(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -161,7 +165,7 @@ class TestUserResource(TestCase):
     self.assertEqual(popen_mock.call_count, 1)
 
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_attribute_gid(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -177,7 +181,7 @@ class TestUserResource(TestCase):
 
   @patch('resource_management.core.providers.accounts.UserProvider.user_groups', new_callable=PropertyMock)
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_attribute_groups(self, getpwnam_mock, popen_mock, user_groups_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0
@@ -194,7 +198,7 @@ class TestUserResource(TestCase):
     self.assertEqual(popen_mock.call_count, 1)
 
   @patch.object(subprocess, "Popen")
-  @patch.object(pwd, "getpwnam")
+  @patch("pwd.getpwnam")
   def test_missing_shell_argument(self, getpwnam_mock, popen_mock):
     subproc_mock = MagicMock()
     subproc_mock.returncode = 0

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py b/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py
index 6092717..29a22b2 100644
--- a/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py
+++ b/ambari-agent/src/test/python/resource_management/TestXmlConfigResource.py
@@ -24,7 +24,9 @@ import os
 import time
 from unittest import TestCase
 from mock.mock import patch, MagicMock
-from resource_management.core import Environment, sudo
+from only_for_platform import get_platform, not_for_platform, PLATFORM_WINDOWS
+
+from resource_management.core import Environment
 from resource_management.core.system import System
 from resource_management.libraries import XmlConfig
 
@@ -37,9 +39,9 @@ class TestXmlConfigResource(TestCase):
   """
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   @patch.object(time, "asctime")
   def test_action_create_empty_xml_config(self,
                                           time_asctime_mock,
@@ -66,9 +68,9 @@ class TestXmlConfigResource(TestCase):
 
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   @patch.object(time, "asctime")
   def test_action_create_simple_xml_config(self,
                                            time_asctime_mock,
@@ -95,9 +97,9 @@ class TestXmlConfigResource(TestCase):
 
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   @patch.object(time, "asctime")
   def test_action_create_xml_config_with_metacharacters(self,
                                                         time_asctime_mock,
@@ -147,9 +149,9 @@ class TestXmlConfigResource(TestCase):
     create_file_mock.assert_called_with('/dir/conf/file.xml', u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name></name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>prop.1</name>\n      <value>&#39;.&#39;yyyy-MM-dd-HH</value>\n      <attr1>x</attr1>\n    </property>\n    \n    <property>\n      <name>prop.2</name>\n      <value>INFO, openjpa</value>\n    </property>\n    \n    <property>\n      <name>prop.3</name>\n      <value>%d{ISO8601} %5p %c{1}:%L - %m%n</value>\n      <attr2>value3</attr2>\n    </property>\n    \n    <property>\n      <name>prop.4</name>\n      <value>${oozie.log.dir}/oozie.log</value>\n      <attr_value_empty></attr_value_empty>\n      <attr2>value4</attr2>\n    </property>\n    \n    <property>\n      <name>prop.empty</name>\n      <value></value>\n      <attr_value_empty></attr_value_empty>\n    </property>\n    \n  </configuration>', encoding='UTF-8')
 
   @patch("resource_management.core.providers.system._ensure_metadata")
-  @patch.object(sudo, "create_file")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.create_file")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   @patch.object(time, "asctime")
   def test_action_create_xml_config_sorted_by_key(self,
                                                   time_asctime_mock,
@@ -180,8 +182,8 @@ class TestXmlConfigResource(TestCase):
     create_file_mock.assert_called_with('/dir/conf/file.xml', u'<!--Wed 2014-02-->\n    <configuration>\n    \n    <property>\n      <name></name>\n      <value></value>\n    </property>\n    \n    <property>\n      <name>first</name>\n      <value>should be first</value>\n    </property>\n    \n    <property>\n      <name>second</name>\n      <value>should be second</value>\n    </property>\n    \n    <property>\n      <name>third</name>\n      <value>should be third</value>\n    </property>\n    \n    <property>\n      <name>z_last</name>\n      <value>should be last</value>\n    </property>\n    \n  </configuration>', encoding='UTF-8')
 
   @patch("resource_management.libraries.providers.xml_config.File")
-  @patch.object(sudo, "path_exists")
-  @patch.object(sudo, "path_isdir")
+  @patch("resource_management.core.sudo.path_exists")
+  @patch("resource_management.core.sudo.path_isdir")
   def test_action_create_arguments(self, os_path_isdir_mock ,os_path_exists_mock, file_mock):
 
     os_path_isdir_mock.side_effect = [False, True]

http://git-wip-us.apache.org/repos/asf/ambari/blob/4e2b2d84/ambari-common/src/test/python/only_for_platform.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/test/python/only_for_platform.py b/ambari-common/src/test/python/only_for_platform.py
index 1b08db5..fba2771 100644
--- a/ambari-common/src/test/python/only_for_platform.py
+++ b/ambari-common/src/test/python/only_for_platform.py
@@ -45,3 +45,8 @@ def for_specific_platforms(systems):
     if platform.system() in systems:
       return obj
   return decorator
+
+if get_platform() != PLATFORM_WINDOWS:
+  os_distro_value = ('Suse','11','Final')
+else:
+  os_distro_value = ('win2012serverr2','6.3','WindowsServer')


Mime
View raw message