Unit tests on Windows: 13 failures besides the CLI ones in #1459 (one also on any machine with an NVIDIA GPU)
Maintainer thường phản hồi trong vòng 2 ngà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
- 76/100
Hướng nghiên cứu
Bắt đầu với tests/test_rapl_mmio_scanning.py, tests/test_electricitymaps_cache.py và tests/test_emissions_tracker.py; issue mô tả các trường hợp bị lỗi và những cách sửa được đề xuất chỉ dành cho kiểm thử. Đọc các dấu skip Linux liên quan, bước kiểm tra TTL của cache và thiết lập mock GPU. Sau đó chạy các tệp kiểm thử bị ảnh hưởng trên Windows và, với trường hợp GPU, dùng trình điều khiển NVIDIA. Hoàn thành khi 13 lỗi được báo cáo đã được sửa và các kiểm thử chạy thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Running the unit tests locally on Windows 11 (Python 3.12, master 24ddb59a, -m 'not integ_test') gives 773 passed, 15 failed, 20 skipped. Two of the 15 are the CLI tests that #1459 fixes (with #1459 applied, tests/cli passes here: 78 passed). CI runs on Linux without a GPU, so the other 13 don't show up there. They fall into three groups, each with a test-only fix that I checked on this machine.
1. Eleven RAPL tests create folders named intel-rapl:0
_make_rapl_tree creates intel-rapl:{index} directories. : is not allowed in Windows file names, so mkdir raises NotADirectoryError: [WinError 267] The directory name is invalid (the same character problem as #79). These tests set sys.platform to "linux" with monkeypatch, while the other RAPL tests in the same file and in test_rapl_parameters.py and test_rapl_permissions.py are skipped off Linux with:
@pytest.mark.skipif(not sys.platform.lower().startswith("lin"), reason="requires Linux")
Adding the same marker would skip them on Windows and change nothing on Linux.
The 11 failing tests (tests/test_rapl_mmio_scanning.py)
test_rapl_start_flags_only_nonzero_mirrored_package_counters(3 cases)test_rapl_start_keeps_dram_when_it_matches_a_package_countertest_rapl_start_skips_unreadable_counterstest_rapl_start_reevaluates_mirror_candidatestest_rapl_confirmed_mirror_is_dropped_after_identical_deltastest_rapl_coincidental_match_is_restored_after_diverging_deltastest_rapl_mirrors_near_counter_wrap_are_still_detectedtest_rapl_candidate_with_skipped_sample_stays_pendingtest_rapl_inconclusive_candidate_stays_pending
2. test_expired_cache_entry_is_refetched (Python 3.12 on Windows)
The test patches ELECTRICITYMAPS_CACHE_TTL to 0 and expects the second call to refetch, but the cache check is time.monotonic() - cached[0] <= ELECTRICITYMAPS_CACHE_TTL. On Windows, Python 3.12's time.monotonic() uses GetTickCount64() (resolution 15.6 ms), so two calls within one tick give a difference of exactly 0 and the cached value is returned: 1 request instead of 2. Python 3.13 switched to QueryPerformanceCounter() (0.1 µs), so I'd expect this only on 3.12. Patching the TTL to -1 instead of 0 makes the test independent of the clock; with that change the file passes here (10 passed, 3 runs).
3. test_task_energy_with_live_update_interference (any machine with an NVIDIA driver)
The total energy exceeds the expected 0.00015 kWh by 1.6e-6 to 3.1e-6 kWh depending on the run. The difference is gpu_energy, measured from this laptop's real GPU (gpu_model in the result is the RTX 3050 Ti). TestCarbonTracker patches codecarbon.core.gpu.pynvml with fake_pynvml, but codecarbon/core/gpu.py calls NVML through gpu_nvidia.pynvml, which that patch does not replace, so the test reaches the real driver when one is installed. Adding
@mock.patch("codecarbon.core.gpu_nvidia.pynvml", fake_pynvml)
to the class makes this test pass here, and all 39 tests in tests/test_emissions_tracker.py still pass with it. I expect the same failure on Linux with an NVIDIA GPU, but I only ran it on Windows.
I can send these three changes as one test-only PR if that's useful.
(Checked and drafted with an AI assistant, Claude Code, and reviewed by me.)
- Ngôn ngữ chính
- Python
- Star
- 1.9k
- Fork
- 347
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 20
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- 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 mlco2/codecarbon
-
get_cloud_geo_region() returns NaN instead of the city for GCP regions with no stateCó thể đã có người làm @Maduk86 đã nhận 3 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
mlco2/codecarbon#1456 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
count_cpus() and RAM crash with FileNotFoundError when SLURM_JOB_ID is set but scontrol is missingĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
mlco2/codecarbon#1455 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
CLI: get_config() returns None without [codecarbon] section; get_api_endpoint() appends api_endpoint under wrong sectionCó thể đã có người làm @sohammishra864-wq đã nhận 30 ngày trước. Đang mở
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 82/100
mlco2/codecarbon#1432 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Update the screen shot of the dashboardCó thể đã có người làm @KLGani đã nhận 4 ngày trước. Đang mởdocumentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mlco2/codecarbon#1423 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Update the bibtex citationCó thể đã có người làm @davidberenstein1957 đã nhận 78 ngày trước. Đang mởdocumentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
mlco2/codecarbon#1422 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của mlco2/codecarbon
Issue tương tự
-
factory
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Arize-ai/phoenix#17420 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
FireDynamics/LEDSmokeAnalysis#176 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PC
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Make `ocifs` optionalĐang mởdependencies
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
dlt-contrib/dlt-filesystem#51 ·
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 68/100
Maintainer thường phản hồi trong vòng 1 ngày