test: Add unit test coverage for hardware_detect utility
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 79/100
Hướng nghiên cứu
Đọc backend/app/utils/hardware_detect.py và làm theo các mẫu kiểm thử hiện có trong backend/tests. Thêm backend/tests/test_hardware_detect.py với các lệnh gọi hệ thống được mô phỏng để kiểm thử năm hàm công khai được nêu tên và các trường hợp biên đã liệt kê. Chạy tệp kiểm thử mới; hoàn tất khi các kiểm thử chạy thành công trên những đường dẫn phát hiện được chỉ định mà không cần phần cứng vật lý.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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!
- Ngôn ngữ chính
- Python
- Star
- 322
- Fork
- 793
- Merge trung bình
- 6 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 21
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AOSSIE-Org/PictoPy
-
bug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
AOSSIE-Org/PictoPy#1788 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)Có thể đã có người làm @omkar-suryavanshi đã nhận 2 ngày trước. Đang mởbug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
AOSSIE-Org/PictoPy#1780 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't workCó thể đã có người làm @swastiksharma45 đã nhận 4 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
AOSSIE-Org/PictoPy#1779 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
BUG: PROD: Face search shows "No Matches Found" for every empty result, even when AI tagging is offCó thể đã có người làm @Piyush0000 đã nhận 1 ngày trước. Đang mởbug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
AOSSIE-Org/PictoPy#1770 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
BUG: Add images to album: success message shows requested count, not number actually addedCó thể đã có người làm @riyanshbhosale đã nhận 7 ngày trước. Đang mởbug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
AOSSIE-Org/PictoPy#1740 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của AOSSIE-Org/PictoPy
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
comet-ml/opik#9877 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Resource]: FlavianĐang mởresource-submission validation-passed
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
hesreallyhim/awesome-claude-code#3736 · 1 bình luận ·
-
area: trackers bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Review: WordPress copy/snapshot download media with no size cap and a hostname-only origin checkĐang mởperformance product:quill
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Community-Access/quill#2634 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày