test: Add unit test coverage for hardware_detect utility
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 79/100
Research direction
Read backend/app/utils/hardware_detect.py and follow the existing test patterns under backend/tests. Add backend/tests/test_hardware_detect.py with mocked system calls to cover the five named public functions and their listed edge cases. Run the new test file; done when the tests pass across the specified detection paths without requiring physical hardware.
Written by the indexing model from the issue text.
Description
What's missing
backend/app/utils/hardware_detect.py has zero test coverage right now. This module is responsible for figuring out what hardware a user's machine has (GPU, Apple Silicon, RAM) and recommending the right AI model tier (nano / small / medium). It's a pretty critical piece — if something breaks here, users silently end up with the wrong model for their hardware.
What I'd like to add
A test file backend/tests/test_hardware_detect.py covering all 5 public functions:
detect_physical_gpu()— nvidia-smi not found, single/multiple GPU parsing, error handling (OSError, timeout), blank-line strippingdetect_apple_silicon()— non-Mac returns None, non-arm64 returns None, sysctl happy path, sysctl failure fallback chain (processor → generic string)detect_apple_silicon_tier()— base M1/M2 → small, Pro/Max/Ultra/M3+ → medium, non-Apple → Nonedetect_hardware_tier()— Apple Silicon path, GPU-present path, RAM-based tiers, boundary values at exactly 4 GB and 8 GBget_hardware_info()— returned dict has the right keys and values, gpu_detected flag correctness
All system calls (shutil.which, subprocess.run, platform.*, psutil.virtual_memory, ort.get_available_providers) will be mocked so the tests run on any machine without needing actual hardware.
Why it matters
This module quietly drives model selection for the whole app. Having tests here means we catch regressions early — especially around edge cases like timeouts, missing tools, or future chip names.
I'd like to work on this — I've already explored the module and have a good idea of what the test cases should look like. Happy to put up a PR!
- Dominant language
- Python
- Stars
- 322
- Forks
- 793
- Avg merge
- 6d 10h
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/PictoPy
-
bug enhancement
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AOSSIE-Org/PictoPy#1802 · 2 comments ·
Maintainers usually reply within 3 days
-
BUG: XMP metadata export permanently overwrites file modification timestamp (mtime), destroying photo datesPossibly taken @swastiksharma45 claimed this 1 day ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AOSSIE-Org/PictoPy#1788 · 6 comments ·
Maintainers usually reply within 3 days
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)Possibly taken @omkar-suryavanshi claimed this 3 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AOSSIE-Org/PictoPy#1780 · 5 comments ·
Maintainers usually reply within 3 days
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't workPossibly taken @ManyaJain111 claimed this 1 day ago. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AOSSIE-Org/PictoPy#1779 · 2 comments · 1 assignee ·
Maintainers usually reply within 3 days
-
BUG: PROD: Face search shows "No Matches Found" for every empty result, even when AI tagging is offPossibly taken @Piyush0000 claimed this 2 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AOSSIE-Org/PictoPy#1770 · 4 comments ·
Maintainers usually reply within 3 days
All issues in AOSSIE-Org/PictoPy
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"Possibly taken @cestercian claimed this today. Opencomp/cli P2 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
NousResearch/hermes-agent#162259 · 1 comment ·
Maintainers usually reply within 1 day
-
community-request
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NVIDIA-NeMo/Run#727 ·
Maintainers usually reply within 1 day
-
bot-triaged module: higher order operators module: pickle module: pt2-dispatcher oncall: pt2 triaged
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
pytorch/pytorch#207247 · 1 comment ·
Maintainers usually reply within 1 day
-
backend: claude chore dependencies
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
briandconnelly/amicus#606 ·
Maintainers usually reply within 1 day