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

Offen Anfängerfreundlich
#916 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

@devpryan7792 arbeitet bereits daran.

Seit 25.10.2026.

  • #917 von @devpryan7792 — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
78/100
Issue-Typ
Refactoring
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
cli, testing

Rechercherichtung

Suche zuerst in tests/test_cli.py und tests/test_insert_files.py nach isolated_filesystem(); im Issue sind 22 Aufrufe und die betroffenen Tests aufgeführt. Lies, wie diese Tests relative Pfade verwenden, und verwende dann bei Bedarf die pytest-Fixture tmp_path oder wechsle in dieses Verzeichnis. Führe die Testsuite aus und bestätige, dass sie ohne diese Deprecation-Warnungen besteht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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
Vorherrschende Sprache
Python
Sterne
2.2k
Forks
215
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus simonw/sqlite-utils

Alle Issues in simonw/sqlite-utils

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.