Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 8de808b78 -> f52e5f93e


AMBARI-22596. Ambari Builds Are Failing With Python Test Errors (aonishuk)


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

Branch: refs/heads/branch-2.6
Commit: f52e5f93effdaaceb13a3f8d201b26e052f559c1
Parents: 8de808b
Author: Andrew Onishuk <[email protected]>
Authored: Wed Dec 6 14:16:18 2017 +0200
Committer: Andrew Onishuk <[email protected]>
Committed: Wed Dec 6 14:16:18 2017 +0200

----------------------------------------------------------------------
 ambari-server/src/test/python/TestAmbariServer.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f52e5f93/ambari-server/src/test/python/TestAmbariServer.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestAmbariServer.py 
b/ambari-server/src/test/python/TestAmbariServer.py
index a53d274..fcca111 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -132,6 +132,17 @@ with patch.object(platform, "linux_distribution", 
return_value = MagicMock(retur
 
 CURR_AMBARI_VERSION = "2.0.0"
 
+def restore_sys_argv(fn):
+    def wrapped(*args, **kwargs):
+      old_sys_argv = sys.argv
+      try:
+        sys.argv = []
+        return fn(*args, **kwargs)
+      finally:
+        sys.argv = old_sys_argv
+
+    return wrapped
+
 @patch.object(platform, "linux_distribution", new = 
MagicMock(return_value=('Redhat', '6.4', 'Final')))
 @patch("ambari_server.dbConfiguration_linux.get_postgre_hba_dir", new = 
MagicMock(return_value = "/var/lib/pgsql/data"))
 @patch("ambari_server.dbConfiguration_linux.get_postgre_running_status", new = 
MagicMock(return_value = "running"))
@@ -7987,6 +7998,7 @@ class TestAmbariServer(TestCase):
     self.assertEqual(None, result)
     pass
 
+  @restore_sys_argv
   @not_for_platform(PLATFORM_WINDOWS)
   @patch("ambari_server.serverConfiguration.write_property")
   @patch("ambari_server.serverConfiguration.get_ambari_properties")

Reply via email to