Tests use CliRunner.isolated_filesystem(), which is deprecated and will be removed in Click 9.0

Abierto Apto para principiantes
#916 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

@devpryan7792 ya está trabajando en esto.

Desde el 25/10/2026.

  • #917 de @devpryan7792 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
cli, testing

Línea de trabajo

Empieza buscando isolated_filesystem() en tests/test_cli.py y tests/test_insert_files.py; el issue enumera 22 llamadas y las pruebas afectadas. Lee cómo usan rutas relativas esas pruebas y luego usa el fixture tmp_path de pytest o cambia a ese directorio cuando sea necesario. Ejecuta la suite de pruebas y confirma que pasa sin estas advertencias de obsolescencia.

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

Descripción

Running the test suite produces 33 DeprecationWarnings from Click:

DeprecationWarning: 'isolated_filesystem' is deprecated and will be removed in Click 9.0. Use 'tempfile.TemporaryDirectory' or pytest's 'tmp_path' fixture with absolute paths instead.

Once Click 9.0 is released, these tests will fail, since sqlite-utils doesn't pin Click below 9.

Steps to reproduce
git clone https://github.com/simonw/sqlite-utils
cd sqlite-utils
uv run pytest
Expected

Test suite passes with no deprecation warnings from the project's own tests.

Actual

1497 passed, 16 skipped, 33 warnings — all 33 warnings are the isolated_filesystem deprecation.

Affected code

22 with runner.isolated_filesystem(): calls (33 test runs once parametrization is counted):

  • tests/test_cli.py — 19 calls (e.g. test_create_table, test_create_view, test_drop_table, test_enable_wal, test_create_table_strict)
  • tests/test_insert_files.py — 3 calls (test_insert_files, test_insert_files_stdin, test_insert_files_bad_text_encoding_error)

Find them with: grep -n isolated_filesystem tests/*.py

Suggested fix

Replace runner.isolated_filesystem() with pytest's tmp_path fixture (or monkeypatch.chdir(tmp_path) where tests rely on relative paths), as the warning recommends.

Environment
  • macOS (Apple Silicon)
  • Python 3.13.5 (via uv 0.13.5)
  • sqlite-utils 4.2.1, commit [YOUR HASH]
  • pytest 9.1.1
Lenguaje dominante
Python
Estrellas
2.2k
Forks
215
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

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 simonw/sqlite-utils

Todos los issues de simonw/sqlite-utils

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.