Skip to content

feat: add --skip-resource-checks flag to bypass hardware capability g…#889

Open
ajbozarth wants to merge 1 commit intogenerative-computing:mainfrom
ajbozarth:feat/skip-resource-checks-flag
Open

feat: add --skip-resource-checks flag to bypass hardware capability g…#889
ajbozarth wants to merge 1 commit intogenerative-computing:mainfrom
ajbozarth:feat/skip-resource-checks-flag

Conversation

@ajbozarth
Copy link
Copy Markdown
Contributor

@ajbozarth ajbozarth commented Apr 20, 2026

Misc PR

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

Adds a --skip-resource-checks pytest flag that bypasses require_gpu and require_ram hardware-capability gates. When passed, tests that would normally be skipped due to insufficient VRAM or RAM will run regardless — useful for verifying test logic on under-spec machines or reproducing failures reported from higher-spec hardware.

The flag is wired through pytest_configure (which runs before test collection) by setting the _MELLEA_SKIP_RESOURCE_CHECKS env var, which the predicates check at call time. The same env var can be set directly as a CI escape hatch. API credential and Ollama checks are intentionally unaffected.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code as added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

…ates

Adds a pytest CLI flag that disables VRAM/RAM skip predicates, allowing
developers to force-run hardware-gated tests on under-spec machines.
API credential and Ollama checks are intentionally unaffected.

Closes generative-computing#758

Assisted-by: Claude Code
Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
@github-actions github-actions bot added the enhancement New feature or request label Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The PR description has been updated. Please fill out the template for your PR to be reviewed.

@ajbozarth ajbozarth self-assigned this Apr 20, 2026
@ajbozarth ajbozarth marked this pull request as ready for review April 20, 2026 20:09
@ajbozarth ajbozarth requested a review from a team as a code owner April 20, 2026 20:09
@ajbozarth
Copy link
Copy Markdown
Contributor Author

@planetf1 what do you think? this spun out of one of our old discussions

Copy link
Copy Markdown
Member

@psschwei psschwei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Verdict: Request minor changes — the approach is sound but has a few gaps to address.

What's good

  • Clean separation of concerns: flag registered in conftest, propagated as env var, consumed in predicates. The predicates don't need to know about pytest config.
  • Correctly scoped — only bypasses GPU/RAM checks, leaving API key and Ollama checks alone.
  • Early return placement avoids slow hardware detection (sysctl subprocess, torch.cuda init) when bypassed.
  • Docs honestly mention "tests may fail naturally" on machines with no GPU.

Issues to address

1. No tests for the new feature
A simple unit test with monkeypatch.setenv verifying the predicates return non-skipping markers would prevent regressions:

def test_require_gpu_bypass(monkeypatch):
    monkeypatch.setenv("_MELLEA_SKIP_RESOURCE_CHECKS", "1")
    marker = require_gpu(min_vram_gb=9999)
    assert marker.args[0] is False

2. docs/examples/conftest.py already has --ignore-gpu-check / --ignore-ram-check / --ignore-all-checks
The project now has two parallel mechanisms for skipping hardware checks. A user passing --skip-resource-checks won't get examples bypassed. At minimum, document the gap or file a follow-up issue to unify them.

3. test/MARKERS_GUIDE.md not updated
This is the canonical reference for resource gating predicates but has no mention of the new override flag.

4. Empty reason="" on bypass (predicates.py:97, predicates.py:130)
Consistent with existing pattern (line 108), but reason="resource check bypassed (--skip-resource-checks)" would help debugging with pytest -rs.

5. conftest.py:265-267 — try/except could be simplified
Using config.getoption("skip_resource_checks", default=False) (dest name, not flag name) avoids the need for the try/except block entirely.

6. Leading underscore on public env var (_MELLEA_SKIP_RESOURCE_CHECKS)
The docs present this as a user-facing CI escape hatch, but _ conventionally means internal. Consider MELLEA_SKIP_RESOURCE_CHECKS if it's a supported interface.

Minor / nice-to-have

  • Add a pytest_unconfigure hook to clean up the env var (matters if pytest is invoked programmatically multiple times in the same process).
  • One-line addition to AGENTS.md Section 1 quick reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add --skip-resource-checks flag to bypass hardware capability gates

2 participants