cache_invalidation_files with `**` doesn't catch files at the top of the directory
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 74/100
Direzione di ricerca
Inizia seguendo come cache_invalidation_files viene espanso in watched_file_hashes e come _changed_hashed_files(restrict_to=...) filtra quei percorsi; confronta i due comportamenti di corrispondenza descritti nell’issue. Riproduci il problema con file al livello superiore e annidati sotto tests, poi verifica che entrambi attivino una nuova esecuzione per il pattern ricorsivo. L’issue non indica un file di test, quindi individua o aggiungi un test di regressione mirato per entrambi i percorsi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
mutmut 3.8.0 (the same matching code is still on master)
I tried this as a workaround for #626:
cache_invalidation_files = ["tests/**/*.py"]
on_dependency_change = "rerun"
It works for tests/sub/test_deep.py:
1 non-Python file(s) changed; rerunning all mutants: tests/sub/test_deep.py
calc.ops.x_is_adult__mutmut_1: survived
calc.ops.x_is_adult__mutmut_2: survived
but not for tests/test_ops.py. With the script from #626 (bash repro.sh watch) the warm run
still says killed and doesn't print the "rerunning" line.
The baseline is built with Path(".").glob("tests/**/*.py"), where ** can match zero
directories, so tests/test_ops.py does end up in watched_file_hashes. But
_changed_hashed_files(restrict_to=cfg.cache_invalidation_files) then filters with
fnmatch, and for fnmatch **/ needs a literal slash:
>>> from fnmatch import fnmatch
>>> fnmatch("tests/test_ops.py", "tests/**/*.py")
False
>>> fnmatch("tests/a/b.py", "tests/**/*.py")
True
So the file is dropped, and _changed_hashed_files() returns an empty set even though the hash
changed. A top-level tests/conftest.py would never trigger a rerun either.
"tests/*.py" on its own has the opposite problem: the top-level file is caught, but the glob
doesn't recurse, so files in sub-directories never get into the baseline. Listing both works:
tests/**/*.py top-level: missed tests/sub/: caught
tests/*.py top-level: caught tests/sub/: missed
tests/*.py + tests/**/*.py top-level: caught tests/sub/: caught
(checked each combination against a weakened test at both locations)
A fix could be to use the same matching in both places, e.g. PurePath.full_match() on 3.13+,
or check membership in the paths the glob returned.
- Lingua principale
- Python
- Stelle
- 1.5k
- Fork
- 190
- Merge medio
- 1g 11h
- PR unite (30g)
- 8
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 boxed/mutmut
-
Removing `not` from a parenthesized multi-line expression drops the parentheses (InvalidGeneratedSyntaxException, 3.8.0)Forse già presa @jihtsan l’ha presa 18 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
boxed/mutmut#602 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
`run` with a `name__mutmut_*` pattern runs the whole test suite in the clean-test checkForse già presa @Ishaan400 l’ha presa 29 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
boxed/mutmut#592 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Invalid unary plus generated in match statementForse già presa @GhostCoder6969 l’ha presa 38 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
What do the emoji's mean?Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
boxed/mutmut#560 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
boxed/mutmut#529 · 7 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di boxed/mutmut
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
RunestoneInteractive/rs#1661 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
streamlink/streamlink#7192 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
aws-samples/sample-per-model-bedrock#795 ·
I maintainer di solito rispondono entro 1 giorno