Fix type errors in tests and plugins

- Add type: ignore for monkey-patching Database.__init__ in conftest
- Fix CLI test to pass string "2" instead of integer to Click invoke
- Add type: ignore for optional sqlean import
- Fix add_geometry_column test to use "XY" instead of integer 2
- Add type: ignore for click.Context as context manager
- Add type: ignore for enable_fts test that intentionally omits argument
- Add type: ignore for sys._called_from_test dynamic attribute
- Fix rows_from_file test type error for intentional wrong argument
- Handle None from pm.get_hookcallers in plugins.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Simon Willison 2025-12-16 16:40:40 -08:00
commit 792157d120
7 changed files with 12 additions and 11 deletions

View file

@ -11,7 +11,7 @@ create table Gosh2 (c1 text, c2 text, c3 text);
def pytest_configure(config):
import sys
sys._called_from_test = True
sys._called_from_test = True # type: ignore[attr-defined]
@pytest.fixture(autouse=True)
@ -24,9 +24,9 @@ def close_all_databases():
original_init(self, *args, **kwargs)
databases.append(self)
Database.__init__ = tracking_init
Database.__init__ = tracking_init # type: ignore[method-assign]
yield
Database.__init__ = original_init
Database.__init__ = original_init # type: ignore[method-assign]
for db in databases:
try:
db.close()