diff --git a/tests/ert/ui_tests/cli/analysis/conftest.py b/tests/ert/ui_tests/cli/analysis/conftest.py new file mode 100644 index 00000000000..bdbcd5e0197 --- /dev/null +++ b/tests/ert/ui_tests/cli/analysis/conftest.py @@ -0,0 +1,24 @@ +import os + +import pytest + + +@pytest.fixture(autouse=True) +def reduce_omp_num_threads_count(): + multithreading_env_variables = [ + ["OMP_NUM_THREADS", "1"], # OpenMP + ["MKL_NUM_THREADS", "1"], # Intel Math Kernel Library + ["NUMEXPR_NUM_THREADS", "1"], # NumExpr library in Python + ] + for option in multithreading_env_variables: + env_var_name = option[0] + option[1], os.environ[env_var_name] = os.environ.get(env_var_name), option[1] + + yield + + for option in multithreading_env_variables: + env_var_name = option[0] + if option[1] is None: + del os.environ[env_var_name] + else: + os.environ[env_var_name] = option[1]