Skip to content

Commit

Permalink
Expect RuntimeError or ValueError in ntequl test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mferrera committed Jan 17, 2024
1 parent 9b4a4c2 commit cc784de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_equil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down

0 comments on commit cc784de

Please sign in to comment.