Skip to content

Commit 8a93733

Browse files
committed
fix: skip PyTorch-dependent tests in sanity mode
1 parent 3dadb75 commit 8a93733

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎tests/conftest.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@
33

44
os.environ["TOKENIZERS_PARALLELISM"] = "false"
55

6+
# Tests that require PyTorch at import time -- skip during sanity runs
7+
# where PyTorch is not installed.
8+
_PYTORCH_TEST_FILES = ["test_backend.py", "test_helpers.py", "test_server.py"]
9+
10+
collect_ignore = []
11+
612

713
def pytest_addoption(parser):
814
parser.addoption("--sanity", action="store_true", help="Run sanity tests (exclude 'gpu' tests)")
915

1016

17+
def pytest_configure(config):
18+
if config.getoption("--sanity", default=False):
19+
collect_ignore.extend(_PYTORCH_TEST_FILES)
20+
21+
1122
def pytest_collection_modifyitems(config, items):
1223
if config.getoption("--sanity"):
1324
skip_gpu = pytest.mark.skip(reason="Skipping GPU tests for sanity run")

0 commit comments

Comments
 (0)