Unit tests on Windows: 13 failures besides the CLI ones in #1459 (one also on any machine with an NVIDIA GPU)
I maintainer di solito rispondono entro 2 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
Direzione di ricerca
Inizia con tests/test_rapl_mmio_scanning.py, tests/test_electricitymaps_cache.py e tests/test_emissions_tracker.py; l’issue descrive i casi che falliscono e le correzioni proposte che riguardano solo i test. Leggi i relativi marcatori di skip Linux, il controllo del TTL della cache e la configurazione del mock GPU. Poi esegui i file di test interessati su Windows e, per il caso GPU, con un driver NVIDIA. Il lavoro è completo quando i 13 errori segnalati sono stati corretti e i test passano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.)
- Lingua principale
- Python
- Stelle
- 1.9k
- Fork
- 347
- Merge medio
- 2g 13h
- PR unite (30g)
- 20
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un 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 mlco2/codecarbon
-
get_cloud_geo_region() returns NaN instead of the city for GCP regions with no stateForse già presa @Maduk86 l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
mlco2/codecarbon#1456 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
count_cpus() and RAM crash with FileNotFoundError when SLURM_JOB_ID is set but scontrol is missingAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
mlco2/codecarbon#1455 ·
I maintainer di solito rispondono entro 2 giorni
-
CLI: get_config() returns None without [codecarbon] section; get_api_endpoint() appends api_endpoint under wrong sectionForse già presa @sohammishra864-wq l’ha presa 31 giorni fa. Aperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 82/100
mlco2/codecarbon#1432 ·
I maintainer di solito rispondono entro 2 giorni
-
Update the screen shot of the dashboardForse già presa @KLGani l’ha presa 6 giorni fa. Apertadocumentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
mlco2/codecarbon#1423 · 5 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
Update the bibtex citationForse già presa @davidberenstein1957 l’ha presa 79 giorni fa. Apertadocumentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
mlco2/codecarbon#1422 · 5 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di mlco2/codecarbon
Issue simili
-
[oblt-aw][autodoc] Document new required `shared-org-key` input for `obs-aw-dependency-review`Forse già presa @github-actions l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
getchaintips leaves out the active tip once a header is staged on it, where Core always lists itAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
btclib-org/btclib-node#2158 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
dbt-msft/dbt-sqlserver#897 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
Gathin23/cleanyourtv#2770 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Dao-AILab/flash-attention#3097 ·
I maintainer di solito rispondono entro 3 giorni