From 57535ef85b97d95862ec3de443c648e1c6aee139 Mon Sep 17 00:00:00 2001 From: Yurii Motov <109919500+YuriiMotov@users.noreply.github.com> Date: Wed, 27 May 2026 22:22:44 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=85=20Use=20custom=20`changing=5Fdir`?= =?UTF-8?q?=20instead=20of=20`CLIRunner.isolated=5Ffilesystem`=20to=20set?= =?UTF-8?q?=20working=20dir=20(#15616)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/test_translation_fixer/conftest.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/tests/test_translation_fixer/conftest.py b/scripts/tests/test_translation_fixer/conftest.py index 06366d5a45..5c5c0e2dc3 100644 --- a/scripts/tests/test_translation_fixer/conftest.py +++ b/scripts/tests/test_translation_fixer/conftest.py @@ -1,5 +1,8 @@ +import os import shutil import sys +from collections.abc import Generator +from contextlib import contextmanager from pathlib import Path import pytest @@ -23,11 +26,20 @@ def pytest_collection_modifyitems(config, items: list[pytest.Item]) -> None: item.add_marker(skip_on_windows) +@contextmanager +def changing_dir(directory: str | Path) -> Generator[None, None, None]: + initial_dir = os.getcwd() + os.chdir(directory) + try: + yield + finally: + os.chdir(initial_dir) + + @pytest.fixture(name="runner") -def get_runner(): - runner = CliRunner() - with runner.isolated_filesystem(): - yield runner +def get_runner(tmp_path: Path): + with changing_dir(tmp_path): + yield CliRunner() @pytest.fixture(name="root_dir") From ad09734fa3e69b9cbd0fd2d57ba59fa8e73c2f86 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 27 May 2026 20:23:09 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20Update=20release=20notes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip ci] --- docs/en/docs/release-notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/en/docs/release-notes.md b/docs/en/docs/release-notes.md index 0592b28081..3f5fa2fa6f 100644 --- a/docs/en/docs/release-notes.md +++ b/docs/en/docs/release-notes.md @@ -15,6 +15,7 @@ hide: ### Internal +* ✅ Use custom `changing_dir` instead of `CLIRunner.isolated_filesystem` to set working dir. PR [#15616](https://github.com/fastapi/fastapi/pull/15616) by [@YuriiMotov](https://github.com/YuriiMotov). * ✅ Add `httpx2` test dependency to avoid deprecation warning. PR [#15603](https://github.com/fastapi/fastapi/pull/15603) by [@YuriiMotov](https://github.com/YuriiMotov). * ⬆ Bump the python-packages group with 15 updates. PR [#15594](https://github.com/fastapi/fastapi/pull/15594) by [@dependabot[bot]](https://github.com/apps/dependabot). * 👷 Configure Dependabot to group updates and update weekly. PR [#15560](https://github.com/fastapi/fastapi/pull/15560) by [@YuriiMotov](https://github.com/YuriiMotov).