tests: Add a mage meshingtool test.

setup.py
Pierre-Antoine Rouby 2024-01-19 11:20:53 +01:00
parent 486ff5c239
commit b6f0c6f49a
4 changed files with 57 additions and 2 deletions

View File

@ -52,7 +52,8 @@ class MeshingWithMage(AMeshingTool):
self._init_c_purge() self._init_c_purge()
self._init_c_output_bief() self._init_c_output_bief()
def _lib_path(self): @classmethod
def _lib_path(cls):
ext = "so" if os.name == "posix" else "dll" ext = "so" if os.name == "posix" else "dll"
return os.path.abspath( return os.path.abspath(

17
src/Meshing/__init__.py Normal file
View File

@ -0,0 +1,17 @@
# __init__.py -- Pamhyr
# Copyright (C) 2023 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-

View File

@ -0,0 +1,37 @@
# test_Model.py -- Pamhyr
# Copyright (C) 2023 INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# -*- coding: utf-8 -*-
import os
import unittest
import warnings
import tempfile
from Model.Saved import SavedStatus
from Model.Study import Study
from Model.River import River
from Meshing.Mage import MeshingWithMage
mage_mesher = os.path.exists(MeshingWithMage._lib_path())
class MeshingTestCase(unittest.TestCase):
@unittest.skipIf(not mage_mesher, "libbief is not available")
def test_create_meshingtool_mage(self):
mesher = MeshingWithMage()
self.assertNotEqual(mesher, None)

View File

@ -11,7 +11,7 @@ pip3 install -U -r ./full-requirements.txt
echo " UNITTEST" echo " UNITTEST"
cd src/ cd src/
python3 -m unittest discover -v -t . python3 -Walways -m unittest discover -v -t .
cd .. cd ..
echo " PEP8" echo " PEP8"