IS_WINDOWS = sys.platform == "win32"
IS_PPC = platform.machine() == "ppc64le"
+# Environment variable `IS_PYTORCH_CI` is set in `.jenkins/common.sh`.
+IS_PYTORCH_CI = bool(os.environ.get('IS_PYTORCH_CI', 0))
+
def _check_module_exists(name):
r"""Returns if a top-level module with :attr:`name` exists *without**
def find_test_index(test, selected_tests, find_last_index=False):
- """Find the index of the first or last occurrence of a given test/test module in the list of seleceted tests.
+ """Find the index of the first or last occurrence of a given test/test module in the list of selected tests.
- This function is used to determine the indexes when slicing the list of selected tests when
+ This function is used to determine the indices when slicing the list of selected tests when
``options.first``(:attr:`find_last_index`=False) and/or ``options.last``(:attr:`find_last_index`=True) are used.
:attr:`selected_tests` can be a list that contains multiple consequent occurrences of tests
from torch.utils.data import _utils, Dataset, TensorDataset, DataLoader, ConcatDataset
from torch.utils.data._utils import ExceptionWrapper, MP_STATUS_CHECK_INTERVAL
from torch.utils.data.dataset import random_split
-from common_utils import (TestCase, run_tests, TEST_NUMPY, IS_WINDOWS, IS_PPC, NO_MULTIPROCESSING_SPAWN,
- skipIfRocm, load_tests)
+from common_utils import (TestCase, run_tests, TEST_NUMPY, IS_WINDOWS, IS_PPC,
+ IS_PYTORCH_CI, NO_MULTIPROCESSING_SPAWN, skipIfRocm,
+ load_tests)
try:
import psutil
HAS_PSUTIL = True
except ImportError:
HAS_PSUTIL = False
- warnings.warn(
- "psutil not found. Some crucial data loader tests relying on it (e.g., "
- "TestDataLoader.test_proper_exit) will not run.")
+ err_msg = ("psutil not found. Some critical data loader tests relying on it "
+ "(e.g., TestDataLoader.test_proper_exit) will not run.")
+ if IS_PYTORCH_CI:
+ raise ImportError(err_msg)
+ else:
+ warnings.warn(err_msg)
# load_tests from common_utils is used to automatically filter tests for