Skip to content

Commit

Permalink
Reinforce testenv in ax test case (facebook#2530)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebook#2530

Differential Revision: D58842047
  • Loading branch information
Daniel Cohen authored and facebook-github-bot committed Jun 21, 2024
1 parent 46a1a17 commit 6d27f15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ax/utils/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ class Keys(str, Enum):

DEFAULT_WINSORIZATION_LIMITS_MINIMIZATION: Tuple[float, float] = (0.0, 0.2)
DEFAULT_WINSORIZATION_LIMITS_MAXIMIZATION: Tuple[float, float] = (0.2, 0.0)

TESTENV_ENV_KEY = "TESTENV"
TESTENV_ENV_VAL = "True"
3 changes: 3 additions & 0 deletions ax/utils/common/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io
import linecache
import logging
import os
import signal
import sys
import types
Expand All @@ -39,6 +40,7 @@
import numpy as np
from ax.exceptions.core import AxParameterWarning
from ax.utils.common.base import Base
from ax.utils.common.constants import TESTENV_ENV_KEY, TESTENV_ENV_VAL
from ax.utils.common.equality import object_attribute_dicts_find_unequal_fields
from ax.utils.common.logger import get_logger
from botorch.exceptions.warnings import InputDataWarning
Expand Down Expand Up @@ -301,6 +303,7 @@ def signal_handler(signum: int, frame: Optional[FrameType]) -> None:

super().__init__(methodName=methodName)
signal.signal(signal.SIGALRM, signal_handler)
os.environ[TESTENV_ENV_KEY] = TESTENV_ENV_VAL

def setUp(self) -> None:
"""
Expand Down

0 comments on commit 6d27f15

Please sign in to comment.