← Back to issue list

static tests: enable type checking by use of mypy

View original Github issue

Metadata

Project
snapcraft
Number
#1747
Type
pull request
State
merged
Author
sergiusens
Labels
Created
Updated
Closed

Current evaluation

Merged after two approvals and passing CI. Enabled mypy type checking for static tests by resolving initial type errors and removing dead storeapi compat code. Integrated into runtests.sh static, deferring unit package init typing as a TODO.

Suggested action:

No scores available.

Issue body

Make the initial set of changes for mypy to pass and run it as part of ./runtests.sh static. As part of this, `compat` from the storeapi was removed as it was dead code had mypy issues on almost every line of its implementation. Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com> - [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? -----

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged after two approvals and passing CI. Enabled mypy type checking for static tests by resolving initial type errors and removing dead storeapi compat code. Integrated into runtests.sh static, deferring unit package init typing as a TODO.
qwen3.6-35b-a3b-mtp-q6 Merged. Enabled mypy type checking for static tests and removed dead compat code from storeapi due to type errors. Added a follow-up TODO for test package initialization.
qwen3.6-35b-a3b-mtp-q6 Merged. Integrated mypy static type checking into the test suite by fixing initial type errors and removing dead compat code from storeapi. Deferred fixing type issues in snapcraft.tests.unit.__init__ to a follow-up.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#3027 static: mypy requires __init__.py snapcraft merged Merged. Added missing __init__.py files to resolve mypy type hint errors and work around mypy bug #1645. Fixed an unused import warning noted in review. CI checks passed.
72%
#2738 mypy: add coverage to tests snapcraft merged Merged changes adding mypy static type checking to unit tests. Updated mypy.ini to target Python 3.6 and applied minor test fixups for successful execution. Approved by one reviewer and merged with 12 additions and 11 deletions across seven files.
72%
#35 Make type checkers aware of type annotations craft-cli merged Merged to add a py.typed file to craft-cli, enabling static type checkers like mypy to recognize its type annotations. Approved and passed CI.
70%