Skip to content
Snippets Groups Projects
Commit 729a59d9 authored by Martin Bauer's avatar Martin Bauer
Browse files

pytest.raises: checking for exception error message fixed

- str(e) did work in previous pytest version
- but the correct usage is str(e.value)
- in newer pytest version the string for the e object is changed so
  the tests did not work any more
parent 0991d716
Branches
No related merge requests found
......@@ -92,7 +92,7 @@ def test_advanced_initialization():
shear_flow_scenario = create_fully_periodic_flow(initial_velocity=init_vel, relaxation_rate=1.95)
with pytest.raises(ValueError) as e:
shear_flow_scenario.run_iterative_initialization(max_steps=20000, check_residuum_after=500)
assert 'did not converge' in str(e)
assert 'did not converge' in str(e.value)
shear_flow_scenario = create_fully_periodic_flow(initial_velocity=init_vel, relaxation_rate=1.6)
shear_flow_scenario.run_iterative_initialization(max_steps=20000, check_residuum_after=500)
......@@ -9,7 +9,7 @@ def test_relaxation_rate():
relaxation_rates=[1 + i / 10 for i in range(19)])
with pytest.raises(ValueError) as e:
get_shear_relaxation_rate(method)
assert 'Shear moments are relaxed with different relaxation' in str(e)
assert 'Shear moments are relaxed with different relaxation' in str(e.value)
method = create_lb_method(stencil="D2Q9", method='mrt_raw',
relaxation_rates=[1 + i / 10 for i in range(9)])
......
......@@ -67,7 +67,7 @@ def test_free_functions():
with pytest.raises(ValueError) as e:
get_stencil("name_that_does_not_exist")
assert "No such stencil" in str(e)
assert "No such stencil" in str(e.value)
def test_visualize():
......
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