]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix python test with input file 10266/head
authorDaniel Arndt <arndtd@ornl.gov>
Tue, 19 May 2020 03:58:52 +0000 (23:58 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Tue, 19 May 2020 03:59:20 +0000 (23:59 -0400)
contrib/python-bindings/source/triangulation_wrapper.cc
contrib/python-bindings/tests/CMakeLists.txt
contrib/python-bindings/tests/manifold_wrapper.py

index 6a93a3977f70b21271a463cc6a5c7fa5bed25eaa..98a71a1fb7f87c502960911accef0e1bd93f3953 100644 (file)
@@ -781,6 +781,7 @@ namespace python
       GridIn<dim, spacedim> mesh_reader;
       mesh_reader.attach_triangulation(*tria);
       std::ifstream ifs(filename);
+      AssertThrow(ifs, ExcIO());
       mesh_reader.read(ifs, input_format);
       ifs.close();
     }
index f010303ca79665ff1e6e3fb32dd3e769e600216e..a9187973f17ba5f1264cb023292bd7fb0632f894 100644 (file)
@@ -22,9 +22,12 @@ ENABLE_TESTING()
 FILE(GLOB _tests "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
 FOREACH(_test_path ${_tests})
  GET_FILENAME_COMPONENT(_test ${_test_path} NAME_WE)
+ GET_FILENAME_COMPONENT(_test_directory ${_test_path} DIRECTORY)
  ADD_TEST(NAME python-bindings/${_test} COMMAND ${PYTHON_EXECUTABLE} ${_test_path})
  SET_TESTS_PROPERTIES(python-bindings/${_test} PROPERTIES ENVIRONMENT
    PYTHONPATH=${CMAKE_BINARY_DIR}/${DEAL_II_PYTHON_RELDIR}/../:$ENV{PYTHONPATH}
+   ENVIRONMENT
+   DEAL_II_PYTHON_TESTPATH=${_test_directory}
    )
 ENDFOREACH()
 
index 947af539159909d2ec3226fd0b2474cd604f35c2..3ce9ef7cd0fe6d652083e758fce13d6ca3ff2331 100644 (file)
@@ -14,6 +14,7 @@
 # ---------------------------------------------------------------------
 
 import math
+import os
 import unittest
 from PyDealII.Debug import *
 
@@ -78,7 +79,8 @@ class TestManifoldWrapperFunction(unittest.TestCase):
                                         lambda p: [math.sqrt(p[0]), math.sqrt(p[1])] )
 
         self.tria_reference = Triangulation('2D')
-        self.tria_reference.read('manifold_wrapper.vtk', 'vtk')
+        test_directory = os.environ.get('DEAL_II_PYTHON_TESTPATH')
+        self.tria_reference.read(test_directory+'/manifold_wrapper.vtk', 'vtk')
 
     def test_manifold_str(self):
         self.triangulation = Triangulation('2D')

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.