Skip to content

Commit

Permalink
Have cli tests set env variable OMP_NUM_THREADS to 1.
Browse files Browse the repository at this point in the history
This commit adds an auto-used fixture for all cli tests, that sets the environment variable for numpy multithreading `OMP_NUM_THREADS` to 1.
This might have been the cause of those tests hanging, as numpy uses all resources available if the env variable is not explicitly set.
  • Loading branch information
jonathan-eq authored and sondreso committed Nov 1, 2024
1 parent 12f9b9c commit 85eeb13
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/ui_tests/cli/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

import pytest


@pytest.fixture(autouse=True)
def reduce_omp_num_threads_count():
old_omp_num_threads = os.environ.get("OMP_NUM_THREADS")
os.environ["OMP_NUM_THREADS"] = "1"

yield

if old_omp_num_threads is None:
del os.environ["OMP_NUM_THREADS"]
else:
os.environ["OMP_NUM_THREADS"] = old_omp_num_threads

0 comments on commit 85eeb13

Please sign in to comment.