mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
Merge branch 'dont_run_slow_tests' into 'master'
Dont run slow tests See merge request jschoeberl/netgen!226
This commit is contained in:
commit
48086d343c
@ -103,7 +103,14 @@ build_ubuntu_debug:
|
||||
script:
|
||||
- docker build -t netgen_${CI_PIPELINE_ID}:${UBUNTU_VERSION} -f tests/dockerfile .
|
||||
- rm -f netgen_${CI_PIPELINE_ID}_$UBUNTU_VERSION.id
|
||||
- docker run --cidfile netgen_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id -e CCACHE_DIR=/ccache -v /mnt/ccache:/ccache netgen_${CI_PIPELINE_ID}:${UBUNTU_VERSION} bash /root/src/netgen/tests/build_debug.sh
|
||||
- >-
|
||||
docker run
|
||||
--cidfile netgen_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id
|
||||
-e CCACHE_DIR=/ccache
|
||||
-e RUN_SLOW_TESTS=${RUN_SLOW_TESTS}
|
||||
-v /mnt/ccache:/ccache
|
||||
netgen_${CI_PIPELINE_ID}:${UBUNTU_VERSION}
|
||||
bash /root/src/netgen/tests/build_debug.sh
|
||||
- docker commit `cat netgen_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id` netgen_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION}
|
||||
- rm netgen_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id
|
||||
|
||||
@ -113,7 +120,14 @@ build_ubuntu_mpi:
|
||||
script:
|
||||
- docker build -t netgen_mpi_${CI_PIPELINE_ID}:${UBUNTU_VERSION} -f tests/dockerfile_mpi .
|
||||
- rm -f netgen_mpi_${CI_PIPELINE_ID}_$UBUNTU_VERSION.id_mpi
|
||||
- docker run --cidfile netgen_mpi_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id -e CCACHE_DIR=/ccache -v /mnt/ccache:/ccache netgen_mpi_${CI_PIPELINE_ID}:${UBUNTU_VERSION} bash /root/src/netgen/tests/build_mpi.sh
|
||||
- >-
|
||||
docker run>-
|
||||
--cidfile netgen_mpi_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id>-
|
||||
-e CCACHE_DIR=/ccache
|
||||
-e RUN_SLOW_TESTS=${RUN_SLOW_TESTS}
|
||||
-v /mnt/ccache:/ccache
|
||||
netgen_mpi_${CI_PIPELINE_ID}:${UBUNTU_VERSION}
|
||||
bash /root/src/netgen/tests/build_mpi.sh
|
||||
- docker commit `cat netgen_mpi_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id` netgen_mpi_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION}
|
||||
- rm netgen_mpi_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id
|
||||
|
||||
@ -123,6 +137,7 @@ test_ubuntu_debug:
|
||||
script:
|
||||
- >-
|
||||
docker run
|
||||
-e RUN_SLOW_TESTS=${RUN_SLOW_TESTS}
|
||||
-e NETGENDIR=/opt/netgen/bin
|
||||
-e PYTHONPATH=/opt/netgen/lib/python3/dist-packages
|
||||
netgen_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION}
|
||||
@ -135,6 +150,7 @@ test_ubuntu_mpi:
|
||||
script:
|
||||
- >-
|
||||
docker run
|
||||
-e RUN_SLOW_TESTS=${RUN_SLOW_TESTS}
|
||||
-e NETGENDIR=/opt/netgen/bin
|
||||
-e PYTHONPATH=/opt/netgen/lib/python3/dist-packages
|
||||
netgen_mpi_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION}
|
||||
|
20
tests/pytest/conftest.py
Normal file
20
tests/pytest/conftest.py
Normal file
@ -0,0 +1,20 @@
|
||||
"""
|
||||
Pytest configuration file to run slow test only if pytest is started with option --runslow or if
|
||||
environment variable RUN_SLOW_TESTS is set.
|
||||
"""
|
||||
|
||||
import pytest, os
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption("--runslow", action="store_true", default=False, help="run slow tests")
|
||||
|
||||
def pytest_configure(config):
|
||||
config.addinivalue_line("markers", "slow: mark test as slow to run")
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(config, items):
|
||||
if not (('RUN_SLOW_TESTS' in os.environ and os.environ['RUN_SLOW_TESTS']) or config.getoption("--runslow")):
|
||||
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
|
||||
for item in items:
|
||||
if "slow" in item.keywords:
|
||||
item.add_marker(skip_slow)
|
@ -1,7 +1,6 @@
|
||||
|
||||
import os, pytest
|
||||
from netgen.meshing import meshsize, MeshingParameters, SetMessageImportance
|
||||
import netgen.gui
|
||||
import netgen.csg as csg
|
||||
import netgen.stl as stl
|
||||
try:
|
||||
@ -46,12 +45,10 @@ def getMeshingparameters(filename):
|
||||
return standard[3:] # coarser meshes don't work here
|
||||
return standard
|
||||
|
||||
# TODO: step files do not respect gui meshsizes yet.
|
||||
_geofiles = [f for f in getFiles(".geo")] + [f for f in getFiles(".stl")]
|
||||
if has_occ:
|
||||
_geofiles += [f for f in getFiles(".step")]
|
||||
|
||||
|
||||
def generateMesh(filename, mp):
|
||||
if filename.endswith(".geo"):
|
||||
geo = csg.CSGeometry(os.path.join("..","..","tutorials", filename))
|
||||
@ -61,7 +58,17 @@ def generateMesh(filename, mp):
|
||||
geo = occ.OCCGeometry(os.path.join("..","..","tutorials", filename))
|
||||
return geo.GenerateMesh(**mp)
|
||||
|
||||
@pytest.mark.parametrize("filename, checkFunc", [(f, getCheckFunc(f)) for f in _geofiles])
|
||||
def isSlowTest(filename):
|
||||
return filename in ["cubemcyl.geo", "frame.step", "revolution.geo", "manyholes.geo", "torus.geo",
|
||||
"cubemsphere.geo", "manyholes2.geo", "matrix.geo", "trafo.geo", "ellipticcone.geo",
|
||||
"period.geo", "shaft.geo", "cubeandring.geo", "ellipticcyl.geo",
|
||||
"ellipsoid.geo", "cone.geo"]
|
||||
|
||||
def getParamForTest(filename):
|
||||
return pytest.param(filename, getCheckFunc(filename), marks=pytest.mark.slow) if isSlowTest(filename) \
|
||||
else (filename, getCheckFunc(filename))
|
||||
|
||||
@pytest.mark.parametrize(("filename, checkFunc"), [getParamForTest(f) for f in _geofiles])
|
||||
def test_geoFiles(filename, checkFunc):
|
||||
for i, mp in enumerate(getMeshingparameters(filename)):
|
||||
print("load geo", filename)
|
||||
|
Loading…
Reference in New Issue
Block a user