Tighten pyright and pytest warning config deferred from copier template adoption

Aperta
#215 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
devtools, testing

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Python
Stelle
47
Fork
15
Merge medio
1g 23h
PR unite (30g)
3

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DiamondLightSource/pythonSoftIOC

Tutte le issue di DiamondLightSource/pythonSoftIOC

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.