From eb08739012cf8dc3e2a520514ca4c6ca3a7677e0 Mon Sep 17 00:00:00 2001 From: Markus Holzer <markus.holzer@fau.de> Date: Sat, 11 Nov 2023 02:53:51 +0100 Subject: [PATCH] [Fix] Warning filter in fluctuating LB test --- lbmpy_tests/test_fluctuating_lb.py | 24 ++++++++++++------------ lbmpy_tests/test_force.py | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lbmpy_tests/test_fluctuating_lb.py b/lbmpy_tests/test_fluctuating_lb.py index 79e9d0ea..d156e24e 100644 --- a/lbmpy_tests/test_fluctuating_lb.py +++ b/lbmpy_tests/test_fluctuating_lb.py @@ -1,6 +1,15 @@ """Tests velocity and stress fluctuations for thermalized LB""" +import warnings +import pytest import pystencils as ps + +from pystencils import get_code_str +from pystencils.backends.simd_instruction_sets import get_supported_instruction_sets, get_vector_instruction_set +from pystencils.cpu.cpujit import get_compiler_config +from pystencils.enums import Target +from pystencils.rng import PhiloxTwoDoubles + from lbmpy.creationfunctions import * from lbmpy.forcemodels import Guo from lbmpy.macroscopic_value_kernels import macroscopic_values_setter @@ -8,13 +17,6 @@ import numpy as np from lbmpy.enums import Stencil from lbmpy.moments import is_bulk_moment, is_shear_moment, get_order from lbmpy.stencils import LBStencil -from pystencils.rng import PhiloxTwoDoubles - -import pytest -from pystencils import get_code_str -from pystencils.backends.simd_instruction_sets import get_supported_instruction_sets, get_vector_instruction_set -from pystencils.cpu.cpujit import get_compiler_config -from pystencils.enums import Target def _skip_instruction_sets_windows(instruction_sets): @@ -294,13 +296,11 @@ def test_vectorization(data_type, assume_aligned, assume_inner_stride_one, assum ) if not assume_inner_stride_one and 'storeS' not in get_vector_instruction_set(data_type, instruction_set): - with pytest.warns(UserWarning) as warn: + with pytest.warns(UserWarning) as pytest_warnings: ast = ps.create_kernel(collision, config=config) - assert 'Could not vectorize loop' in warn[0].message.args[0] + assert 'Could not vectorize loop' in pytest_warnings[0].message.args[0] else: - with pytest.warns(None) as warn: - ast = ps.create_kernel(collision, config=config) - assert len(warn) == 0 + ast = ps.create_kernel(collision, config=config) ast.compile() code = get_code_str(ast) print(code) diff --git a/lbmpy_tests/test_force.py b/lbmpy_tests/test_force.py index f0f59bb5..d0debdd2 100644 --- a/lbmpy_tests/test_force.py +++ b/lbmpy_tests/test_force.py @@ -24,7 +24,7 @@ force_models = [f for f in ForceModel if f is not ForceModel.CENTRALMOMENT] def test_total_momentum(method_enum, zero_centered, force_model, omega): if method_enum == Method.CUMULANT and \ force_model not in (ForceModel.SIMPLE, ForceModel.LUO, ForceModel.GUO, ForceModel.HE): - return True + return L = (16, 16) stencil = LBStencil(Stencil.D2Q9) @@ -308,7 +308,7 @@ def test_symmetric_forcing_equivalence(force_model, compressible): nested_moments=moment_polys, compressible=True, force_model=force_model, force=tuple(F)) method = create_lb_method(lbm_config=lbm_config) if not method.force_model.has_symmetric_central_moment_forcing: - return True + return subs_dict = method.subs_dict_relaxation_rate force_moments = method.force_model.central_moment_space_forcing(method) -- GitLab