[glom/glom-1-30] Python tests: Output any unexpected python error message to std::cerr.



commit fc05ab5919a9416d42c226f04fa3e444110a1913
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Feb 29 13:08:32 2016 +0100

    Python tests: Output any unexpected python error message to std::cerr.

 tests/python/test_python_execute_func.cc           |    5 ++++-
 .../test_python_execute_func_change_result_type.cc |    5 ++++-
 tests/python/test_python_execute_func_date.cc      |    7 +++++++
 3 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/tests/python/test_python_execute_func.cc b/tests/python/test_python_execute_func.cc
index 34b821b..64801ff 100644
--- a/tests/python/test_python_execute_func.cc
+++ b/tests/python/test_python_execute_func.cc
@@ -39,7 +39,10 @@ int main()
   //std::cout << "type=" << g_type_name(value.get_value_type()) << std::endl;
 
   //Check that there was no python error:
-  g_assert(error_message.empty());
+  if(!error_message.empty()) {
+    std::cerr << "Unexpected error message: " << error_message << "\n";
+    return EXIT_FAILURE;
+  }
 
   //Check that the return value is of the expected type:
   g_assert(value.get_value_type() == GDA_TYPE_NUMERIC);
diff --git a/tests/python/test_python_execute_func_change_result_type.cc 
b/tests/python/test_python_execute_func_change_result_type.cc
index fcdcad7..082950c 100644
--- a/tests/python/test_python_execute_func_change_result_type.cc
+++ b/tests/python/test_python_execute_func_change_result_type.cc
@@ -40,7 +40,10 @@ int main()
   //std::cout << "type=" << g_type_name(value.get_value_type()) << std::endl;
 
   //Check that there was no python error:
-  g_assert(error_message.empty());
+  if(!error_message.empty()) {
+    std::cerr << "Unexpected error message: " << error_message << "\n";
+    return EXIT_FAILURE;
+  }
 
   //Check that the return value is of the expected type:
   g_assert(Glom::Field::get_glom_type_for_gda_type(value.get_value_type()) == result_type);
diff --git a/tests/python/test_python_execute_func_date.cc b/tests/python/test_python_execute_func_date.cc
index 4d1dd9b..eefb0ec 100644
--- a/tests/python/test_python_execute_func_date.cc
+++ b/tests/python/test_python_execute_func_date.cc
@@ -7,6 +7,7 @@
 #include <glom/libglom/init.h>
 #include <glom/python_embed/glom_python.h>
 #include <libglom/data_structure/glomconversions.h>
+#include <iostream>
 
 void execute_func_with_date_return_value()
 {
@@ -26,6 +27,9 @@ void execute_func_with_date_return_value()
   //std::cout << "type=" << g_type_name(value.get_value_type()) << std::endl;
 
   //Check that there was no python error:
+  if(!error_message.empty()) {
+    std::cerr << "Unexpected error message: " << error_message << "\n";
+  }
   g_assert(error_message.empty());
   
   //Check that the return value is of the expected type:
@@ -61,6 +65,9 @@ void execute_func_with_date_input_value()
   //std::cout << "type=" << g_type_name(value.get_value_type()) << std::endl;
 
   //Check that there was no python error:
+  if(!error_message.empty()) {
+    std::cerr << "Unexpected error message: " << error_message << "\n";
+  }
   g_assert(error_message.empty());
   
   //Check that the return value is of the expected type:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]