Repository navigation
Skip the PyTorch Geometric plugin tests without torch_geometric - #3023
kevalmorabia97 merged 1 commit into
Conversation
The PyTorch Geometric quantization plugin is optional: it registers
only when torch_geometric imports. Its tests import torch_geometric
unconditionally, so without it pytest stops collecting:
ModuleNotFoundError: No module named 'torch_geometric'
The other tests in tests/unit/torch/quantization/plugins that need an
optional package (accelerate, diffusers, peft, transformers) skip when
it's missing. Skip these the same way.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Connor Baker <[email protected]>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Skip tests when PyG is unavailable tests/unit/torch/quantization/plugins/test_pytorch_geometric_plugin.py |
The module calls pytest.importorskip("torch_geometric") before importing PyG layers. |
Priority:
Estimated code review effort: 1 (Trivial) | ~3 minutes
Change: Bug fix
Suggested reviewers: kevalmorabia97
Merge Risk: 
Minimal · up to 9e079
-
The optional PyTorch Geometric tests now skip cleanly when the dependency is unavailable.
Pre-merge checks: 
6
-
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.
Full details: Security Anti-Patterns
-
Explanation
PASS. The pull request changes only
tests/unit/torch/quantization/plugins/test_pytorch_geometric_plugin.py. It addspytest.importorskip("torch_geometric")before the PyTorch Geometric imports. It does not changemodeloptorexamplesPython code, add security-sensitive calls, add# nosec, or modify dependency files.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Please fix the code quality issues and merge the PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3023 +/- ##
=======================================
Coverage 77.49% 77.50%
=======================================
Files 661 661
Lines 74949 74949
=======================================
+ Hits 58085 58086 +1
+ Misses 16864 16863 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the review! The I don't have write access to this repository, so I can't re-run the job or merge the PR myself. Could a maintainer re-run it and merge? AI disclosure: this comment was drafted with Claude Code (Claude Opus 5.5). |
|
/ok to test 9e07937 |
What does this PR do?
Type of change: Bug fix
The PyTorch Geometric quantization plugin is optional:
modelopt/torch/quantization/plugins/__init__.pyloads it underimport_plugin("torch_geometric"). Buttests/unit/torch/quantization/plugins/test_pytorch_geometric_plugin.pyimportstorch_geometricunconditionally, so in an environment without it, pytest stops at collection and runs nothing else:The other tests in that directory that need an optional package (accelerate, diffusers, peft, transformers) skip when it's missing. This skips these the same way, with
pytest.importorskip("torch_geometric").torch-geometricis in thedev-testextra, so CI, which installs it, isn't affected. This is for environments without it, such as a distribution's package build.Usage
N/A
Testing
The file together with
tests/unit/torch/test_import.py, on main at efda42c:torch_geometric, main:Interrupted: 1 error during collection, nothing runs. With this PR:1 passed, 1 skipped.torch_geometric2.8.1 installed, with this PR: the three geometric tests run and pass.pre-commit runwith this repository's configuration (ruff 0.15.20, mypy 2.1.0) passes on the changed file.Before your PR is "Ready for review"
CONTRIBUTING.md: N/AAdditional Information
Found while packaging 0.47.0 for Nixpkgs (NixOS/nixpkgs#577198). The file is the same in 0.47.0 and
release/0.48.0.AI disclosure: this change, the testing described above and this description were produced with Claude Code (Claude Opus 5.5).
🤖 Generated with Claude Code
Summary by CodeRabbit