Unverified Commit 7c8bbba8 authored by René Fritze's avatar René Fritze Committed by GitHub
Browse files

update DUNE versions (#1709)

- [config] bump supported dune versions
- [tests] ensure we get no dune import warnings in our CI
parents fbb3ff6c 85882ace
Pipeline #156477 failed with stages
in 278 minutes and 36 seconds
......@@ -40,26 +40,25 @@ def _get_fenics_version():
def _get_dunegdt_version():
import dune.xt
import dune.gdt
version = 'outdated'
try:
version = dune.gdt.__version__
if parse(version) < parse('2021.1.2') or parse(version) >= parse('2021.2'):
warnings.warn('dune-gdt bindings have been tested for version 2021.1.x (x >= 2) '
f'(installed: {dune.gdt.__version__}).')
except AttributeError:
warnings.warn('dune-gdt bindings have been tested for version 2021.1.x (x >= 2) '
'(installed: unknown older than 2021.1.2).')
try:
xt_version = dune.xt.__version__
if parse(xt_version) < parse('2021.1.2') or parse(xt_version) >= parse('2021.2'):
warnings.warn('dune-gdt bindings have been tested for dune-xt 2021.1.x (x >= 2) '
f'(installed: {dune.xt.__version__}).')
except AttributeError:
warnings.warn('dune-gdt bindings have been tested for dune-xt version 2021.1.x (x >= 2) '
'(installed: unknown older than 2021.1.2).')
return version
import importlib
version_ranges = {"dune-gdt": ('2021.1.2', '2022.2'), "dune-xt": ('2021.1.2', '2022.2')}
def _get_version(dep_name):
min_version, max_version = version_ranges[dep_name]
module = importlib.import_module(dep_name.replace("-", "."))
try:
version = module.__version__
if parse(version) < parse(min_version) or parse(version) >= parse(max_version):
warnings.warn(f'{dep_name} bindings have been tested for versions between '
'{min_version} and {max_version} (installed: {version}).')
except AttributeError:
warnings.warn(f'{dep_name} bindings have been tested for versions between '
'{min_version} and {max_version} (installed unknown version).')
version = None
return version
_get_version("dune-xt")
return _get_version("dune-gdt")
def is_windows_platform():
......
......@@ -2,6 +2,8 @@
# Copyright pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause)
import os
import warnings
import pytest
from pymor.core.config import config, _PACKAGES
......@@ -12,3 +14,27 @@ from pymor.core.config import config, _PACKAGES
reason='Guarantee only valid in the docker container')
def test_config(pkg):
assert getattr(config, f'HAVE_{pkg}')
@pytest.mark.skipif(condition=not os.environ.get('DOCKER_PYMOR', False),
reason='Guarantee only valid in the docker container')
def test_no_dune_warnings():
_test_dune_import_warn()
@pytest.mark.skipif(condition=not os.environ.get('DOCKER_PYMOR', False),
reason='Guarantee only valid in the docker container')
def test_dune_warnings(monkeypatch):
from dune import xt, gdt
monkeypatch.setattr(gdt, "__version__", "2020.0.0")
monkeypatch.setattr(xt, "__version__", "2020.0.0")
with pytest.xfail(""):
_test_dune_import_warn()
def _test_dune_import_warn():
with warnings.catch_warnings():
from pymor.core.config import _get_dunegdt_version
# this will result in an error if a warning is caught
warnings.simplefilter("error")
_get_dunegdt_version()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment