Tighten pyright and pytest warning config deferred from copier template adoption

Abierto
#215 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
devtools, testing

Línea de trabajo

Start with [tool.pyright] in pyproject.toml, the existing tests/test_records.py and tests/test_autosave.py, and the type-checking tox environment. Run tox -e type-checking to see the pyright errors, then run the test suite with warnings treated as errors. Done means the chosen rules and standard mode are configured, warnings are resolved, and the suite passes on all CI platforms.

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

Descripción

Adopting python-copier-template (PR to follow) adds pyright and the template's pytest config, but to keep that PR free of code changes both are configured leniently. This issue tracks tightening them. The ruff equivalent is #214.

Pyright

The adoption PR runs pyright in basic mode (the template uses standard) with these rules turned off in [tool.pyright] in pyproject.toml:

  • reportArgumentType
  • reportAssignmentType
  • reportAttributeAccessIssue
  • reportOperatorIssue
  • reportOptionalCall
  • reportOptionalMemberAccess
  • reportOptionalSubscript
  • reportUndefinedVariable (names from from x import *; may need to stay off, or be fixed with explicit __all__/imports)
  • reportUnusedExpression
  • reportWildcardImportFromLibrary

With those rules on, the current code gives about 155 errors in basic mode and 178 in standard mode. softioc/iocStats (third-party submodule) stays excluded.

pytest warnings

The template sets filterwarnings = "error"; the adoption PR leaves it out because some tests raise warnings, e.g. files left open (ResourceWarning) in tests/test_records.py and tests/test_autosave.py.

Done when

  • The disabled pyright rules are re-enabled (or kept off with a stated reason, e.g. star imports) and tox -e type-checking passes.
  • typeCheckingMode is standard, matching the template.
  • The tests close their files, filterwarnings = "error" is set, and the suite passes on all CI platforms.
Lenguaje dominante
Python
Estrellas
47
Forks
15
Merge medio
1 d 23 h
PR fusionados (30 d)
3

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 DiamondLightSource/pythonSoftIOC

Todos los issues de DiamondLightSource/pythonSoftIOC

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.