test: Add unit test coverage for hardware_detect utility
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 79/100
Direzione di ricerca
Leggi backend/app/utils/hardware_detect.py e segui i modelli di test esistenti in backend/tests. Aggiungi backend/tests/test_hardware_detect.py con chiamate di sistema simulate per coprire le cinque funzioni pubbliche nominate e i casi limite elencati. Esegui il nuovo file di test; il lavoro è completato quando i test passano per i percorsi di rilevamento specificati senza richiedere hardware fisico.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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!
- Lingua principale
- Python
- Stelle
- 322
- Fork
- 793
- Merge medio
- 6g 11h
- PR unite (30g)
- 21
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AOSSIE-Org/PictoPy
-
bug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/PictoPy#1788 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)Forse già presa @omkar-suryavanshi l’ha presa 2 giorni fa. Apertabug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/PictoPy#1780 · 5 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't workForse già presa @swastiksharma45 l’ha presa 4 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
AOSSIE-Org/PictoPy#1779 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: PROD: Face search shows "No Matches Found" for every empty result, even when AI tagging is offForse già presa @Piyush0000 l’ha presa 1 giorno fa. Apertabug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
AOSSIE-Org/PictoPy#1770 · 4 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: Add images to album: success message shows requested count, not number actually addedForse già presa @riyanshbhosale l’ha presa 7 giorni fa. Apertabug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
AOSSIE-Org/PictoPy#1740 · 4 commenti ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di AOSSIE-Org/PictoPy
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 89/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
smk762/argus-atlas#97 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
xdslproject/xdsl#6842 ·
I maintainer di solito rispondono entro 1 giorno