Skip to content

Commit 11ec7d0

Browse files
committed
refactor: replace requires_heavy_ram gate with huggingface backend marker in examples conftest
The legacy requires_heavy_ram marker (blanket 48 GB RAM threshold) conflated VRAM with system RAM. Replace both the collection-time and runtime skip logic to gate on the huggingface backend marker instead, which accurately checks GPU availability.
1 parent 7158e64 commit 11ec7d0

1 file changed

Lines changed: 6 additions & 20 deletions

File tree

docs/examples/conftest.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,8 @@ def _should_skip_collection(markers):
123123
if "slow" in markers and int(os.environ.get("SKIP_SLOW", 0)) == 1:
124124
return True, "Skipping slow test (SKIP_SLOW=1)"
125125

126-
# Skip tests requiring heavy RAM if insufficient
127-
if "requires_heavy_ram" in markers:
128-
RAM_THRESHOLD_GB = 48
129-
if capabilities["ram_gb"] > 0 and capabilities["ram_gb"] < RAM_THRESHOLD_GB:
130-
return (
131-
True,
132-
f"Insufficient RAM ({capabilities['ram_gb']:.1f}GB < {RAM_THRESHOLD_GB}GB)",
133-
)
134-
135126
# Skip tests requiring GPU if not available
136-
if "requires_gpu" in markers or "vllm" in markers:
127+
if "requires_gpu" in markers or "huggingface" in markers or "vllm" in markers:
137128
if not capabilities["has_gpu"]:
138129
return True, "GPU not available"
139130

@@ -588,7 +579,6 @@ def pytest_runtest_setup(item):
588579
config = item.config
589580
ignore_all = config.getoption("--ignore-all-checks", default=False)
590581
ignore_gpu = config.getoption("--ignore-gpu-check", default=False) or ignore_all
591-
ignore_ram = config.getoption("--ignore-ram-check", default=False) or ignore_all
592582
ignore_ollama = (
593583
config.getoption("--ignore-ollama-check", default=False) or ignore_all
594584
)
@@ -612,18 +602,14 @@ def pytest_runtest_setup(item):
612602
)
613603

614604
# Skip tests requiring GPU if not available
615-
if item.get_closest_marker("requires_gpu") and not ignore_gpu:
605+
if (
606+
item.get_closest_marker("requires_gpu")
607+
or item.get_closest_marker("huggingface")
608+
or item.get_closest_marker("vllm")
609+
) and not ignore_gpu:
616610
if not capabilities["has_gpu"]:
617611
pytest.skip("Skipping test: GPU not available")
618612

619-
# Skip tests requiring heavy RAM if insufficient
620-
if item.get_closest_marker("requires_heavy_ram") and not ignore_ram:
621-
RAM_THRESHOLD_GB = 48 # Based on real-world testing
622-
if capabilities["ram_gb"] > 0 and capabilities["ram_gb"] < RAM_THRESHOLD_GB:
623-
pytest.skip(
624-
f"Skipping test: Insufficient RAM ({capabilities['ram_gb']:.1f}GB < {RAM_THRESHOLD_GB}GB)"
625-
)
626-
627613
# Backend-specific skipping
628614
if item.get_closest_marker("watsonx") and not ignore_api_key:
629615
if not capabilities["has_api_keys"].get("watsonx"):

0 commit comments

Comments
 (0)