pyproject.toml: a comment or `]` inside a pytest list drops entries

Abierto Apto para principiantes
#158 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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
86/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
testing

Línea de trabajo

Empieza en src/repo/adapters/python.ts, en readPytestSettings y splitList, y luego lee el caso some_function() en tests/repo/python-adapter.test.ts. Añade cobertura para los tres ejemplos TOML y una lista multilínea con una coma final; haz que una entrada incierta establezca settings.unreadable. Ejecuta npm test y confirma que se conservan los valores de la lista y que se cubre el fallback para entradas ilegibles.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

adapter bug good first issue

readPytestSettings in src/repo/adapters/python.ts reads python_files, testpaths and pythonpath from [tool.pytest.ini_options] with a regex. The regex takes everything up to the first ], and splitList splits it on whitespace and commas. TOML comments and brackets inside strings both break this:

[tool.pytest.ini_options]
python_files = [
  "test_*.py",  # see [docs]
  "check_*.py",
]

Today this returns ["test_*.py", "#", "see", "[docs"], which drops check_*.py. With the comment # unit instead, it returns ["test_*.py", "#", "unit", "check_*.py"]. testpaths = ["tests/[a]", "integration"] returns ["tests/[a"], which drops integration.

Done when:

  • Comments outside strings are ignored, and a ] or , inside a quoted string stays part of the value. Splitting the list into quoted strings works better than splitting on whitespace.
  • Anything the reader can't parse with certainty sets settings.unreadable, as a non-literal value already does (see the some_function() case in the test). DiffCI then runs the full suite, which is safe. Never guess.
  • tests/repo/python-adapter.test.ts has cases for the three examples above, plus a multi-line list with a trailing comma.

New to DiffCI? See CONTRIBUTING.md: add a synthetic fixture, run npm test, and sign off commits with git commit -s. Comment here to claim the issue.

Lenguaje dominante
TypeScript
Estrellas
0
Forks
4
Merge medio
18 h 41 min
PR fusionados (30 d)
48

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DiffCI/core

Todos los issues de DiffCI/core

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.