cockpit icon indicating copy to clipboard operation
cockpit copied to clipboard

Run mypy on testlib.py

Open jelly opened this issue 3 years ago • 4 comments

This is just a PR to add mypy for testlib.py and make it pass. The typing in testlib.py is not complete yet.

In the future we can lint src/cockpit but that is actually quite trivial.

jelly avatar Aug 11 '22 16:08 jelly

@allisonkarlitskaya argggh so the issue is:

drwxr-xr-x 2 root root 4.0K Aug 16 15:46 builder

And builder tries to write config.log in the previous image it was:

builder@175cc8c22bf2:~$ ls -lh /home/
total 0
drwxr-xr-x 1 builder nogroup 0 Jul 24 22:06 builder

So yay debian changed adduser in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679746

jelly avatar Aug 16 '22 15:08 jelly

Proof mypy works https://github.com/cockpit-project/cockpit/runs/7878382609?check_suite_focus=true

jelly avatar Aug 17 '22 12:08 jelly

Wondering if check-memory failing on clang is https://bugs.kde.org/show_bug.cgi?id=452758

jelly avatar Aug 17 '22 13:08 jelly

I wonder if you want to first try getting this working with systemd_ctypes as a practice run?

Sounds good, also an excellent time to figure out how the library stub files should be shipped :-)

jelly avatar Aug 17 '22 15:08 jelly

This has diverged too much, needs rework. We have a pyproject.toml now and run mypy on src. Just not on test/common this currently fails:

[jelle@t14s][~/projects/cockpit/main]%mypy test/common
test/common/lcov.py:35: error: Cannot find implementation or library stub for module named "task"  [import]
test/common/lcov.py:35: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
test/common/testlib.py: error: Source file found twice under different module names: "test.common.testlib" and "testlib"
test/common/testlib.py: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#mapping-file-paths-to-modules for more info
test/common/testlib.py: note: Common resolutions include: a) adding `__init__.py` somewhere, b) using `--explicit-package-bases` or adjusting MYPYPATH
Found 2 errors in 2 files (errors prevented further checking)

jelly avatar Jun 19 '23 14:06 jelly