From: Daniel Arndt Date: Tue, 19 May 2020 03:58:52 +0000 (-0400) Subject: Fix python test with input file X-Git-Tag: v9.3.0-rc1~1611^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=399dfdbbf99971aa6e5e4178e0e8cdc9f1ea56f5;p=dealii.git Fix python test with input file --- diff --git a/contrib/python-bindings/source/triangulation_wrapper.cc b/contrib/python-bindings/source/triangulation_wrapper.cc index 6a93a3977f..98a71a1fb7 100644 --- a/contrib/python-bindings/source/triangulation_wrapper.cc +++ b/contrib/python-bindings/source/triangulation_wrapper.cc @@ -781,6 +781,7 @@ namespace python GridIn mesh_reader; mesh_reader.attach_triangulation(*tria); std::ifstream ifs(filename); + AssertThrow(ifs, ExcIO()); mesh_reader.read(ifs, input_format); ifs.close(); } diff --git a/contrib/python-bindings/tests/CMakeLists.txt b/contrib/python-bindings/tests/CMakeLists.txt index f010303ca7..a9187973f1 100644 --- a/contrib/python-bindings/tests/CMakeLists.txt +++ b/contrib/python-bindings/tests/CMakeLists.txt @@ -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() diff --git a/contrib/python-bindings/tests/manifold_wrapper.py b/contrib/python-bindings/tests/manifold_wrapper.py index 947af53915..3ce9ef7cd0 100644 --- a/contrib/python-bindings/tests/manifold_wrapper.py +++ b/contrib/python-bindings/tests/manifold_wrapper.py @@ -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')