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). 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")