You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2019/11/06 20:45:44 UTC

[qpid-dispatch] branch master updated: DISPATCH-1377: Fix test to work on python3-only system

This is an automated email from the ASF dual-hosted git repository.

chug pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/master by this push:
     new 6bdf6b2  DISPATCH-1377: Fix test to work on python3-only system
6bdf6b2 is described below

commit 6bdf6b2828fc8d3eed150e7829f2c2e5704a4203
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Wed Nov 6 15:29:17 2019 -0500

    DISPATCH-1377: Fix test to work on python3-only system
    
    Use substitution of PY_STRING to locate discovered python executable.
    Test for required 'ast' module. If not present then skip test.
    Print full error text from teardown.
    This closes #609
---
 .gitignore                                 |  1 +
 CMakeLists.txt                             |  1 +
 tests/system_tests_topology_disposition.py | 23 ++++++++++++++++++-----
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index aa0aaa8..0153fcf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ tests/authservice.py
 tests/failoverserver.py
 tests/system_tests_authz_service_plugin.py
 tests/system_tests_handle_failover.py
+tests/system_tests_topology_disposition.py
 *.iml
 .idea
 .metadata
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27fc706..d7357aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -225,6 +225,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/authservice.py.in ${CMAKE_CURRE
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/failoverserver.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/failoverserver.py)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_authz_service_plugin.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_authz_service_plugin.py)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_handle_failover.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_handle_failover.py)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_topology_disposition.py.in ${CMAKE_CURRENT_SOURCE_DIR}/tests/system_tests_topology_disposition.py)
 execute_process(COMMAND ${RUN} --sh OUTPUT_FILE config.sh)
 
 if (NOT UNITTEST_MISSING)
diff --git a/tests/system_tests_topology_disposition.py b/tests/system_tests_topology_disposition.py
index 9cec6d0..3d8d79e 100644
--- a/tests/system_tests_topology_disposition.py
+++ b/tests/system_tests_topology_disposition.py
@@ -36,6 +36,7 @@ import time
 import datetime
 import pdb
 import inspect
+import sys
 
 
 #================================================
@@ -437,17 +438,23 @@ class TopologyDispositionTests ( TestCase ):
 
     def test_04_scraper_tool ( self ):
         name = 'test_04'
-        error = None
+        error = str(None)
         if self.skip [ name ] :
             self.skipTest ( "Test skipped during development." )
 
+        try:
+            import ast
+        except ImportError:
+            # scraper requires ast which is not installed by default on all platforms
+            self.skipTest ( "Python ast module is not available on this platform." )
+        
         scraper_path = os.path.join(os.environ.get('BUILD_DIR'), 'tests', 'scraper', 'scraper.py')
 
         # aggregate all the log files
         files = []
         for letter in ['A', 'B', 'C', 'D']:
             files.append('../setUpClass/%s.log' % letter)
-        p = self.popen(['/usr/bin/env', 'python', scraper_path, '-f'] + files,
+        p = self.popen(['/usr/bin/env', 'python3', scraper_path, '-f'] + files,
                        stdin=PIPE, stdout=PIPE, stderr=STDOUT,
                        universal_newlines=True)
         out = p.communicate(None)[0]
@@ -456,11 +463,14 @@ class TopologyDispositionTests ( TestCase ):
         except Exception as e:
             error = str(e)
 
-        self.assertEqual ( None, error )
+        if str(None) != error:
+            print("Error text: ", error)
+            sys.stdout.flush()
+        self.assertEqual ( str(None), error )
         self.assertTrue( '</body>' in out )
 
         # split A.log
-        p = self.popen(['/usr/bin/env', 'python', scraper_path, '--split', '-f', '../setUpClass/A.log'],
+        p = self.popen(['/usr/bin/env', 'python3', scraper_path, '--split', '-f', '../setUpClass/A.log'],
                        stdin=PIPE, stdout=PIPE, stderr=STDOUT,
                        universal_newlines=True)
         out = p.communicate(None)[0]
@@ -469,7 +479,10 @@ class TopologyDispositionTests ( TestCase ):
         except Exception as e:
             error = str(e)
 
-        self.assertEqual ( None, error )
+        if str(None) != error:
+            print("Error text: ", error)
+            sys.stdout.flush()
+        self.assertEqual ( str(None), error )
         self.assertTrue( '</body>' in out )
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org