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

Open Beginner friendly
#916 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

@devpryan7792 is already working on this.

Since Oct 25, 2026.

  • #917 by @devpryan7792 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli, testing

Research direction

Start by searching for isolated_filesystem() in tests/test_cli.py and tests/test_insert_files.py; the issue lists 22 calls and the affected tests. Read how those tests use relative paths, then use pytest's tmp_path fixture or change to that directory where needed. Run the test suite and confirm it passes without these deprecation warnings.

Written by the indexing model from the issue text.

Description

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
Dominant language
Python
Stars
2.2k
Forks
215
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from simonw/sqlite-utils

All issues in simonw/sqlite-utils

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.