You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/11/10 01:09:40 UTC

[2/8] incubator-slider git commit: SLIDER-630. slider-agent unit tests fail on debian and suse and windows

SLIDER-630. slider-agent unit tests fail on debian and suse and windows


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/22be6464
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/22be6464
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/22be6464

Branch: refs/heads/feature/SLIDER-623-python
Commit: 22be64644e3e622e8944f21f10d2387b3651a0f1
Parents: b8fbf08
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Sun Nov 9 14:26:54 2014 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Sun Nov 9 14:26:54 2014 -0800

----------------------------------------------------------------------
 slider-agent/src/test/python/python-wrap        | 13 +++++----
 .../resource_management/TestExecuteResource.py  |  2 +-
 slider-agent/src/test/python/unitTests.py       |  2 +-
 slider-assembly/pom.xml                         | 28 ++++++++++++++++++--
 slider-assembly/src/test/python/unitTests.py    |  2 +-
 5 files changed, 37 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/22be6464/slider-agent/src/test/python/python-wrap
----------------------------------------------------------------------
diff --git a/slider-agent/src/test/python/python-wrap b/slider-agent/src/test/python/python-wrap
index ea57721..88a8c55 100755
--- a/slider-agent/src/test/python/python-wrap
+++ b/slider-agent/src/test/python/python-wrap
@@ -17,23 +17,26 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-export PYTHONPATH=/usr/lib/python2.6/site-packages:$PYTHONPATH
-
 # reset settings
 unset PYTHON
 
+if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
+  PYTHON=/usr/bin/python2.6
+fi
+
 # checking for preferable python versions
 if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then
   PYTHON=/usr/bin/python2.7
 fi
 
-if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
-  PYTHON=/usr/bin/python2.6
+# if no preferable python versions found, try to use system one
+if [ -a /usr/bin/python ] && [ -z "$PYTHON" ]; then
+  PYTHON=/usr/bin/python
 fi
 
 # if no preferable python versions found, try to use system one
 if [[ -z "$PYTHON" ]]; then
-  PYTHON=/usr/bin/python
+  PYTHON=python
 fi
 
 # execute script

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/22be6464/slider-agent/src/test/python/resource_management/TestExecuteResource.py
----------------------------------------------------------------------
diff --git a/slider-agent/src/test/python/resource_management/TestExecuteResource.py b/slider-agent/src/test/python/resource_management/TestExecuteResource.py
index f7f6371..0673b66 100644
--- a/slider-agent/src/test/python/resource_management/TestExecuteResource.py
+++ b/slider-agent/src/test/python/resource_management/TestExecuteResource.py
@@ -77,7 +77,7 @@ class TestExecuteResource(TestCase):
                 poll_after = 5)
         self.assertTrue(False, "Should fail as process does not run for 5 seconds")
       except Fail as e:
-        self.assertTrue("returned 1" in e.message)
+        self.assertTrue("returned 1" in str(e))
         pass
 
     self.assertTrue(popen_mock.called, 'subprocess.Popen should have been called!')

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/22be6464/slider-agent/src/test/python/unitTests.py
----------------------------------------------------------------------
diff --git a/slider-agent/src/test/python/unitTests.py b/slider-agent/src/test/python/unitTests.py
index 6aa0167..b65c075 100644
--- a/slider-agent/src/test/python/unitTests.py
+++ b/slider-agent/src/test/python/unitTests.py
@@ -32,7 +32,7 @@ ignoredDirs = ["mock"]
 class TestAgent(unittest.TestSuite):
   def run(self, result, debug=False):
     run = unittest.TestSuite.run
-    run(self, result, debug)
+    run(self, result)
     return result
 
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/22be6464/slider-assembly/pom.xml
----------------------------------------------------------------------
diff --git a/slider-assembly/pom.xml b/slider-assembly/pom.xml
index f549b36..88c3693 100644
--- a/slider-assembly/pom.xml
+++ b/slider-assembly/pom.xml
@@ -38,6 +38,9 @@
     <src.confdir>src/conf-hdp</src.confdir>
     <src.libdir>${project.build.directory}/lib</src.libdir>
     <src.agent.ini.dir>${project.build.directory}/../../slider-agent/conf</src.agent.ini.dir>
+    <python.ver>python &gt;= 2.6</python.ver>
+    <executable.python>${project.basedir}/../slider-agent/src/test/python/python-wrap</executable.python>
+    <python.path.l>${project.basedir}/src/main/scripts:${project.basedir}/../slider-agent/src/test/python/mock:${project.basedir}/src/test/python/scripts</python.path.l>
     <skipTests>false</skipTests>
   </properties>
 
@@ -72,13 +75,13 @@
         <executions>
           <execution>
             <configuration>
-              <executable>python</executable>
+              <executable>${executable.python}</executable>
               <workingDirectory>src/test/python</workingDirectory>
               <arguments>
                 <argument>unitTests.py</argument>
               </arguments>
               <environmentVariables>
-                <PYTHONPATH>${project.basedir}/src/main/scripts:${project.basedir}/../slider-agent/src/test/python/mock:${project.basedir}/src/test/python/scripts</PYTHONPATH>
+                <PYTHONPATH>${python.path.l}</PYTHONPATH>
               </environmentVariables>
               <skip>${skipTests}</skip>
             </configuration>
@@ -235,6 +238,27 @@
   </reporting>
 
   <profiles>
+   <profile>
+      <id>Windows</id>
+      <activation>
+        <os><family>windows</family></os>
+      </activation>
+      <properties>
+        <executable.python>python</executable.python>
+        <python.path.l>${project.basedir}\src\main\scripts;${project.basedir}\..\slider-agent\src\test\python\mock;${project.basedir}\src\test\python\scripts</python.path.l>
+      </properties>
+    </profile>
+
+    <profile>
+      <id>Linux</id>
+      <activation>
+        <os><family>!windows</family></os>
+      </activation>
+      <properties>
+        <executable.python>${project.basedir}/../slider-agent/src/test/python/python-wrap</executable.python>
+        <python.path.l>${project.basedir}/src/main/scripts:${project.basedir}/../slider-agent/src/test/python/mock:${project.basedir}/src/test/python/scripts</python.path.l>
+      </properties>
+    </profile>
     <profile>
       <id>rpm</id>
       <build>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/22be6464/slider-assembly/src/test/python/unitTests.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/test/python/unitTests.py b/slider-assembly/src/test/python/unitTests.py
index aebf4ba..ec1a78c 100644
--- a/slider-assembly/src/test/python/unitTests.py
+++ b/slider-assembly/src/test/python/unitTests.py
@@ -32,7 +32,7 @@ ignoredDirs = ["mock"]
 class TestAgent(unittest.TestSuite):
   def run(self, result, debug=False):
     run = unittest.TestSuite.run
-    run(self, result, debug)
+    run(self, result)
     return result