Skip to content

Commit

Permalink
Removing env SUPPRESS_EXE_VERSION_CHECK
Browse files Browse the repository at this point in the history
  • Loading branch information
bdestombe committed May 28, 2024
1 parent 544ef26 commit f8f675a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
35 changes: 13 additions & 22 deletions nlmod/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,34 +341,20 @@ def get_flopy_bin_directories(version_tag=None, repo="executables"):
meta_list = json.loads(meta_raw)

enable_version_check = version_tag is not None and repo is not None
SUPPRESS_EXE_VERION_CHECK = (
"NLMOD_SUPPRESS_EXE_VERION_CHECK" in os.environ
and os.environ["NLMOD_SUPPRESS_EXE_VERION_CHECK"]
).lower() in ("true", "1", "t") # envvars are always strings

# To convert latest into an explicit tag
if enable_version_check and SUPPRESS_EXE_VERION_CHECK:
msg = (
"The version of the executables would have been checked, because the "
"`version_tag` is passed to `get_flopy_bin_directories()`, but is "
"suppressed by a set NLMOD_SUPPRESS_EXE_VERION_CHECK."
)
elif enable_version_check and not SUPPRESS_EXE_VERION_CHECK:
if enable_version_check:
msg = (
"The version of the executables will be checked, because the "
f"`version_tag={version_tag}` is passed to `get_flopy_bin_directories()`."
)
else:
msg = (
"The version of the executables will not be checked, because the "
"`version_tag` is not passed to `get_flopy_bin_directories()`."
)
logger.info(msg)

if enable_version_check and not SUPPRESS_EXE_VERION_CHECK:
version_tag_pin = get_release(tag=version_tag, repo=repo, quiet=True)[
"tag_name"
]
# To convert latest into an explicit tag
if version_tag == "latest":
version_tag_pin = get_release(tag=version_tag, repo=repo, quiet=True)[
"tag_name"
]
else:
version_tag_pin = version_tag

# get path to the most recent installation. Appended to end of get_modflow.json
meta_list_validversion = [
Expand All @@ -378,7 +364,12 @@ def get_flopy_bin_directories(version_tag=None, repo="executables"):
]

else:
msg = (
"The version of the executables will not be checked, because the "
"`version_tag` is not passed to `get_flopy_bin_directories()`."
)
meta_list_validversion = meta_list
logger.info(msg)

path_list = [
Path(meta["bindir"])
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ full = [
]
knmi = ["h5netcdf", "nlmod[grib]"]
grib = ["cfgrib", "ecmwflibs"]
test = ["pytest>=7", "pytest-cov", "pytest-dependency", "pytest-env"]
test = ["pytest>=7", "pytest-cov", "pytest-dependency"]
nbtest = ["nbformat", "nbconvert>6.4.5"]
lint = ["flake8", "isort", "black[jupyter]"]
ci = ["nlmod[full,lint,test,nbtest]", "netCDF4>=1.6.3", "pandas<2.1.0"]
Expand Down Expand Up @@ -107,6 +107,5 @@ line-length = 88
extend-include = ["*.ipynb"]

[tool.pytest.ini_options]
env = ["NLMOD_SUPPRESS_EXE_VERION_CHECK=True"]
addopts = "--strict-markers --durations=0 --cov-report xml:coverage.xml --cov nlmod -v"
markers = ["notebooks: run notebooks", "slow: slow tests", "skip: skip tests"]

0 comments on commit f8f675a

Please sign in to comment.