cache_invalidation_files with `**` doesn't catch files at the top of the directory
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
Línea de trabajo
Empieza siguiendo cómo se expande cache_invalidation_files en watched_file_hashes y cómo _changed_hashed_files(restrict_to=...) filtra esas rutas; compara los dos comportamientos de coincidencia descritos en el issue. Reproduce el comportamiento con archivos de nivel superior y anidados bajo tests y luego comprueba que ambos provocan una nueva ejecución con el patrón recursivo. El issue no indica un archivo de prueba, así que localiza o añade una prueba de regresión específica para ambas rutas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 1.5k
- Forks
- 190
- Merge medio
- 1 d 11 h
- PR fusionados (30 d)
- 8
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de boxed/mutmut
-
Removing `not` from a parenthesized multi-line expression drops the parentheses (InvalidGeneratedSyntaxException, 3.8.0)Posiblemente ocupada @jihtsan la tomó hace 18 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
boxed/mutmut#602 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
`run` with a `name__mutmut_*` pattern runs the whole test suite in the clean-test checkPosiblemente ocupada @Ishaan400 la tomó hace 29 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
boxed/mutmut#592 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Invalid unary plus generated in match statementPosiblemente ocupada @GhostCoder6969 la tomó hace 38 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
What do the emoji's mean?Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
boxed/mutmut#560 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
boxed/mutmut#529 · 7 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de boxed/mutmut
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
RunestoneInteractive/rs#1661 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
streamlink/streamlink#7192 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
aws-samples/sample-per-model-bedrock#795 ·
Los mantenedores suelen responder en 1 día