mark test tutorials as slow test

This commit is contained in:
Christopher Lackner 2019-08-29 17:37:35 +02:00
parent 331c0b9486
commit 7afbe4d7d1
2 changed files with 21 additions and 1 deletions

20
tests/pytest/conftest.py Normal file
View 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)

View File

@ -1,7 +1,6 @@
import os, pytest import os, pytest
from netgen.meshing import meshsize, MeshingParameters, SetMessageImportance from netgen.meshing import meshsize, MeshingParameters, SetMessageImportance
import netgen.gui
import netgen.csg as csg import netgen.csg as csg
import netgen.stl as stl import netgen.stl as stl
try: try:
@ -61,6 +60,7 @@ def generateMesh(filename, mp):
geo = occ.OCCGeometry(os.path.join("..","..","tutorials", filename)) geo = occ.OCCGeometry(os.path.join("..","..","tutorials", filename))
return geo.GenerateMesh(**mp) return geo.GenerateMesh(**mp)
@pytest.mark.slow
@pytest.mark.parametrize("filename, checkFunc", [(f, getCheckFunc(f)) for f in _geofiles]) @pytest.mark.parametrize("filename, checkFunc", [(f, getCheckFunc(f)) for f in _geofiles])
def test_geoFiles(filename, checkFunc): def test_geoFiles(filename, checkFunc):
for i, mp in enumerate(getMeshingparameters(filename)): for i, mp in enumerate(getMeshingparameters(filename)):