From 57e58b9e5d2c3231af71785877fd304a75162929 Mon Sep 17 00:00:00 2001 From: mferrera Date: Mon, 4 Dec 2023 11:59:30 +0100 Subject: [PATCH] Expect RuntimeError or ValueError in ntequl test Later versions of opm use a newer pybind11 version and potentially different exceptions for input errors in its C++ backend. This makes both `RuntimeError` and `ValueError` possible but tricky to pin down to a particular opm version. This takes the easy route and allows for both. --- tests/test_equil.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_equil.py b/tests/test_equil.py index 698d3c9a4..da26fb15f 100644 --- a/tests/test_equil.py +++ b/tests/test_equil.py @@ -475,8 +475,10 @@ def test_ntequl(): df = equil.df(deckstr, ntequl=1) # We are not able to catch this situation.. assert len(df) == 1 - # But this will fail: - with pytest.raises(ValueError): + # But this will fail. Which exception is raised depends + # on the pybind11 version opm is built with which opm + # version is being used. Both are possible. + with pytest.raises((ValueError, RuntimeError)): equil.df(deckstr, ntequl=3) deckstr = """