-
Notifications
You must be signed in to change notification settings - Fork 71
feat: add pytest markers for test categorization (#322) #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…g#322) Implements comprehensive marker system to categorize tests by backend, resource requirements, and test type. Auto-detects system capabilities (Ollama, API keys, GPU, RAM) and skips tests with clear messaging. - Add backend markers: ollama, openai, watsonx, huggingface, vllm - Add capability markers: requires_api_key, requires_gpu, requires_heavy_ram - Auto-detection: Ollama (port 11434), GPU (CUDA/MPS), RAM (48GB threshold) - CLI overrides: --ignore-{gpu,ram,ollama,api-key}-check - Add comprehensive test/MARKERS_GUIDE.md documentation - Link guide from README.md and docs/tutorial.md - Extends existing CI optimizations from generative-computing#293 (preserves qualitative skip)
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
|
I started the RAM check at 32GB. After extensive cleanup on my macbook m1 I couldn't run the pytorch tests. So upped to 48GB, but cannot test. Other changes to model, quantization could also be done to reduce footprint (I could try adding tests with a smaller model as an additional issue pr if it helps?) - so the need for this condition may change, but I think this makes a clear developer-friendly intent workable |
|
Example output from or Currently the detection code doesn't check the required models are available In draft whilst I verify execution at least on local 32GB mac |
- Add markers to 7 more backend test files (litellm_ollama, openai_ollama, vision_ollama, vision_openai, litellm_watsonx, vllm_tools, huggingface_tools) - Add note that Ollama check only verifies service, not loaded models - Add fixture to normalize OLLAMA_HOST from 0.0.0.0 to 127.0.0.1 for client connections
Adds xgrammar to hf optional dependencies to support constrained decoding in granite_common. Fixes test_answerability failure.
Adds pytest markers to 5 stdlib test files based on model requirements: Heavy RAM tests (8B+ models): - test_spans.py: granite-3.3-8b (huggingface, gpu, heavy_ram) - test_think_budget_forcing.py: gpt-oss:20b (ollama, heavy_ram) GPU-only tests (4B models): - test_rag.py: granite-4.0-micro (huggingface, gpu) Lightweight tests (1B models): - test_sofai_sampling.py: llama3.2:1b (ollama) - test_sofai_graph_coloring.py: llama3.2:1b (ollama)
Adds markers to 3 test files using large Ollama models: - test_genslot.py: granite3.3:8b (22GB, unquantized) - test_component_typing.py: granite3.3:8b (22GB, unquantized) - test_think_budget_forcing.py: gpt-oss:20b (adds requires_gpu) The granite3.3:8b Ollama model is 22GB (full precision), requiring both GPU and heavy RAM despite being only 8B parameters.
|
With the current configuration I was able to run |
Misc PR
Type of PR
Description
Adds pytest markers to categorize tests by backend, resource requirements, and test type.
Key benefit: Run
pytestwith zero config—tests auto-skip based on your system (Ollama running? GPU? API keys?) with clear messages about what's missing.Advanced: Target specific tests:
pytest -m "ollama"orpytest -m "not (requires_gpu or requires_api_key)"Auto-Detection
Usage
Implementation
Markers:
ollama,openai,watsonx,huggingface,vllm,requires_api_key,requires_gpu,requires_heavy_ram,qualitative,llmFiles:
pyproject.toml(psutil dep + markers),test/conftest.py(auto-detection + skip logic),test/MARKERS_GUIDE.md(430-line guide),README.md/docs/tutorial.md(links), 4 test files (example markers)Notes:
See
test/MARKERS_GUIDE.mdfor complete documentation.Testing
Testing notes: Added markers to 4 test files; auto-detection tested via existing suite; all pre-commit hooks passed.