diff --git a/benchmarks/asv_delegated_conda.py b/benchmarks/asv_delegated_conda.py index 34312bad..30810309 100644 --- a/benchmarks/asv_delegated_conda.py +++ b/benchmarks/asv_delegated_conda.py @@ -114,6 +114,7 @@ def _prep_env(self) -> None: message = f"Running delegated environment management for: {self.name}" log.info(message) env_path = Path(self._path) + environ["ESMFMKFILE"] = str(env_path / "lib" / "esmf.mk") def copy_asv_files(src_parent: Path, dst_parent: Path) -> None: """For copying between self._path and a temporary cache.""" diff --git a/benchmarks/benchmarks/generate_data.py b/benchmarks/benchmarks/generate_data.py index 34c7ab5c..dc9127b0 100644 --- a/benchmarks/benchmarks/generate_data.py +++ b/benchmarks/benchmarks/generate_data.py @@ -16,6 +16,7 @@ from pathlib import Path import re from subprocess import CalledProcessError, check_output, run +import sys from textwrap import dedent from warnings import warn @@ -55,6 +56,8 @@ # False forces a benchmark run to re-make all the data files. REUSE_DATA = True +ESMFMKFILE = "ESMFMKFILE" + def run_function_elsewhere(func_to_run, *args, **kwargs): """ @@ -90,9 +93,12 @@ def run_function_elsewhere(func_to_run, *args, **kwargs): f"{func_to_run.__name__}(" + ",".join(func_call_term_strings) + ")" ) python_string = "\n".join([func_string, func_call_string]) + old_esmf_mk_file = environ.get(ESMFMKFILE, None) + environ[ESMFMKFILE] = str(Path(sys.executable).parents[1] / "lib" / "esmf.mk") result = run( [DATA_GEN_PYTHON, "-c", python_string], capture_output=True, check=True ) + environ[ESMFMKFILE] = old_esmf_mk_file return result.stdout diff --git a/noxfile.py b/noxfile.py index 46f55de7..58b1436b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -392,8 +392,6 @@ def benchmarks( Path(".nox").rglob(f"tests*/bin/python{PY_VER}") ).resolve() session.env[data_gen_var] = data_gen_python - esmf_mk_file = data_gen_python.parents[1] / "lib" / "esmf.mk" - session.env[ESMFMKFILE] = esmf_mk_file print("Running ASV...") session.cd("benchmarks")