test_err_cvg_failure does not raise XMIError with modflow-6.5.0-dev
mwtoews opened this issue · 2 comments
mwtoews commented
Using a develop version of MODFLOW 6 (6.5.0) with a small modification:
diff --git a/tests/conftest.py b/tests/conftest.py
index 3d90ac9..0a666bd 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -12,6 +12,7 @@ from xmipy import XmiWrapper
@pytest.fixture(scope="session")
def modflow_lib_path(tmp_path_factory):
+ return "/path/to/src/modflow6/bin/libmf6.so"
tmp_path = tmp_path_factory.getbasetemp()
sysinfo = platform.system()
if sysinfo == "Windows":
one pytest fails. Here is the complete output:
$ pytest tests/test_mf6_dis_errors.py::test_err_cvg_failure
============================================================== test session starts ===============================================================
platform linux -- Python 3.8.10, pytest-7.3.1, pluggy-1.0.0
rootdir: /data/mtoews/src/xmipy
plugins: cov-4.1.0
collected 1 item
tests/test_mf6_dis_errors.py F [100%]
==================================================================== FAILURES ====================================================================
______________________________________________________________ test_err_cvg_failure ______________________________________________________________
flopy_dis_mf6 = (FlopyDis(sim_path='/tmp/pytest-of-mtoews/pytest-113/test_err_cvg_failure0', sim=sim_name = TEST_SIM_DIS
sim_path = /t...iod_data=[[(0, 2, 0), 1.0, 'BNDA'], [(0, 6, 8), 0.0, 'BNDB']]), <xmipy.xmiwrapper.XmiWrapper object at 0x7fe0f4aae430>)
def test_err_cvg_failure(flopy_dis_mf6):
"""Test convergence failure (and a helper for checking I/O)"""
mf6 = flopy_dis_mf6[1]
mf6.initialize()
# prepare, don't solve to completion, should give error
mf6.prepare_time_step(mf6.get_time_step())
mf6.prepare_solve()
mf6.solve()
with pytest.raises(XMIError):
> mf6.finalize_solve()
E Failed: DID NOT RAISE <class 'xmipy.errors.XMIError'>
tests/test_mf6_dis_errors.py:31: Failed
------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------
writing simulation...
writing simulation name file...
writing simulation tdis package...
writing ims package ims_-1...
writing model TEST_MODEL_DIS...
writing model name file...
writing package dis...
writing package ic...
writing package npf...
writing package chd_0...
writing package oc...
============================================================ short test summary info =============================================================
FAILED tests/test_mf6_dis_errors.py::test_err_cvg_failure - Failed: DID NOT RAISE <class 'xmipy.errors.XMIError'>
=============================================================== 1 failed in 0.15s ================================================================
MODFLOW 6
U.S. GEOLOGICAL SURVEY MODULAR HYDROLOGIC MODEL
VERSION 6.5.0 Release Candidate 12/09/2022
***DEVELOP MODE***
MODFLOW 6 compiled Jun 12 2023 23:07:49 with GCC version 9.4.0
This software is preliminary or provisional and is subject to
revision. It is being provided to meet the need for timely best
science. The software has not received final approval by the U.S.
Geological Survey (USGS). No warranty, expressed or implied, is made
by the USGS or the U.S. Government as to the functionality of the
software and related material nor shall the fact of release
constitute any such warranty. The software is provided on the
condition that neither the USGS nor the U.S. Government shall be held
liable for any damages resulting from the authorized or unauthorized
use of the software.
Run start date and time (yyyy/mm/dd hh:mm:ss): 2023/06/14 13:27:41
Writing simulation list file: mfsim.lst
Using Simulation name file: mfsim.nam
Solving: Stress period: 1 Time step: 1
BMI Error, Numerical Solution 1 failed to converge
Run end date and time (yyyy/mm/dd hh:mm:ss): 2023/06/14 13:27:41
Elapsed run time: 0.048 Seconds
Normal termination of simulation.
It is not certain if this is an error with xmipy or upstream with modflow6. Note that the standard output shows " BMI Error, Numerical Solution 1 failed to converge", so an error happens somewhere, but it is not caught in the expected manner.
Hofer-Julian commented
Thanks for reporting!
Yes, the behavior of MODFLOW 6 changed in the meantime, so this test does not make sense anymore.
Can you create a PR to remove it?